Korisne komande

Započeo Correlli, Maj 28, 2010, 16:52:57 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 8 gostiju pregledaju ovu temu.

@''KopriVa', dosta više spamanja.

Evo i jedan od men
Kad hocete da vidite komande naprimer./komande admin il /komande generalno
Da bi vam ova komanda radila potrebno je

  • zcmd
  • sscanf
CMD:komande(playerid, params[])
{
new s[128];

if(sscanf(params,"s[128]",s)) return SendClientMessage(playerid,-1,"Koriscenje:/komande [vrstakomandi]");
SendClientMessage(playerid,-1,"Dostupne vrste:admin,generalno");
if(!strcmp(s, "admin", false))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Morate biti admin");
SendClientMessage(playerid,-1,"/komanda1, /komanda2, /komanda3, /komanda4");
SendClientMessage(playerid,-1,"/komanda5, /komanda6, /komanda7, /komanda8");
}
else if(!strcmp(s,"generalno", false))
{
SendClientMessage(playerid,-1,"/komanda1, /komanda2, /komanda3, /komanda4");
SendClientMessage(playerid,-1,"/komanda5, /komanda6, /komanda7, /komanda8");
}
else {
SendClientMessage(playerid,-1,"Upisali ste pogresnu vrstu");
}
return 1;
}

Proveru za admina zamenite sa svojom

Evo komanda goto od mene, CMD:goto(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, 0x33AA33AA, "Nisi ovlasten!");
new string[128];
new Float:pozp[3], igrac;
if(!sscanf(params, "u", igrac))
{
if(igrac != IPI)
{
GetPlayerPos(igrac, pozp[0], pozp[1], pozp[2]);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vozilo = GetPlayerVehicleID(playerid);
SetVehiclePos(vozilo, pozp[0]+5, pozp[1]+5, pozp[2]);
PutPlayerInVehicle(playerid, vozilo, 0);
}
SetPlayerPos(playerid, pozp[0]+5, pozp[1]+5, pozp[2]);
format(string, sizeof(string), "Portao si se do igraca: %s", Imeigraca(igrac));
SCM(playerid, 0x33AA33AA, string);
}
else return SCM(playerid, 0xDABB3EAA, "Igrac nije online!");
}
else return SCM(playerid, 0xDABB3EAA, "Koriscenje: /goto [ID igraca/Deo Imena]");
return 1;
}
na vrh stavite #define SCM SendClientMessage ,takodje na vrh #define IPI INVALID_PLAYER_ID na kraj moda dodate stock Imeigraca(playerid)
{
new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
i varijablu admina zamenite sa svojom  ;)

Citat: David (Sabljak) poslato Novembar 23, 2012, 17:46:22 POSLE PODNE
evo moja improvizacija suspect tj /su komande...

CMD:su(playerid,params[])
{
    new targetid,reason[128];
new name1[MAX_PLAYER_NAME];
new name2[MAX_PLAYER_NAME];
new wantedlevel;
wantedlevel = GetPlayerWantedLevel(playerid);
new string[128];
if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pMember] == 5) return SCM(playerid,COLOR_RED,"(Policija) {C3C3C3}Niste Policajac!"); // Tu takoder stavite svoje...
if(!IsPlayerInRangeOfPoint(playerid, 5.0,230.3662,72.9093,1005.0391) && !IsPlayerInRangeOfPoint(playerid,5.0,236.3216,111.2964,1003.2188)) return SCM(playerid,COLOR_RED,"(Policija) {C3C3C3}Niste blizu kompjutera!"); // Tu stavite svoje kordinate....
if(sscanf(params,"uis[128]",targetid,wantedlevel,reason)) return SCM(playerid, COLOR_ORANGE,"Koristi: {FFFFFF}/su [Ime_Prezime/ID] [Wanted Level] [Razlog]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}>> [GRESKA] {FFFFFF}Krivi ID!");
if(wantedlevel < 0 || wantedlevel > 6) return SendClientMessage(playerid,COLOR_LIGHTRED,"Wanted level mora bit veci od 0 i manji od 6"); // znaci od 1 do 6 smijete tj mozete stavit wl
{
GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(targetid, name2, sizeof(name2));
format(string, sizeof(string), "[Zlocin] Prijavili ste %s zbog: %s", name2,reason); // salje vama da stE prijavili
SendClientMessage(playerid, COLOR_GOLD, string);
format(string, sizeof(string), "[Zlocin] Prijavljeni ste od Predstavnika Zakona %s , razlog : %s [Wanted Level - %d] ", name1,reason,wantedlevel); // Salje igracu koji je dobio wanted lvl
SendClientMessage(targetid, COLOR_GOLD, string);
format(string, sizeof(string), "[CENTRALA] | Policajac %s | {FFFFFF} %s je trazen zbog: %s [Wanted Level - %d] ", name1,name2,reason,wantedlevel); // Salje poruku svim policajcima
SendPoliceMessage(0x9955DEEE,string);
SetPlayerWantedLevel(playerid,wantedlevel);
if (GetPlayerWantedLevel(playerid) == 6)
{
format(string, sizeof(string), "Izvanredne Vijesti | {FFFFFF}GraÄ'anin %s je trazen od strane zakona! Mole se svi graÄ'ani budu u oprezu!", name2); // Znaci ako ima 6 wanteda salje poruku graÄ'anima :)
SendClientMessageToAll(COLOR_ORANGE,string);
}
  }
    return 1;
}

GF komanda -.-" I nije korisno samo pogledja komandu.. i upitaj se da li svak ima definirano bas ko u tu tebe i ima previse gluposti

Evo jos jedna od mene, setskin : CMD:setskin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1)
{
    new id;
    new skin;
    if(sscanf(params,"ud",id,skin)) return SCM(playerid, -1, "KORISCENJE: /setskin [ID igraca] [Skin]");
else if(id == IPI) return SCM(playerid, -1, "Pogresan ID Igraca!");
else
{
SetPlayerSkin(id, skin);
new poruka[256];
format(poruka,sizeof(poruka), "Administrator vam je promenio skin u ID: %d",skin);
SCM(id, -1, poruka);
}
}
else return SCM(playerid, -1, "Nisi Admin!");
return 1;
}

Stari covek

Citat: Blaeks poslato Decembar 02, 2012, 13:42:24 POSLE PODNE
Evo jos jedna od mene, setskin : CMD:setskin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1)
{
    new id;
    new skin;
    if(sscanf(params,"ud",id,skin)) return SCM(playerid, -1, "KORISCENJE: /setskin [ID igraca] [Skin]");
else if(id == IPI) return SCM(playerid, -1, "Pogresan ID Igraca!");
else
{
SetPlayerSkin(id, skin);
new poruka[256];
format(poruka,sizeof(poruka), "Administrator vam je promenio skin u ID: %d",skin);
SCM(id, -1, poruka);
}
}
else return SCM(playerid, -1, "Nisi Admin!");
return 1;
}

Ne treba ti toliki string od 256 jer SCM i ne moze da posalje toliko karaktera.
Jedan tut koji je koristan: http://balkan-samp.com/forum/index.php?topic=10871.msg81887#msg81887
Poslednja Izmena: Decembar 04, 2012, 16:14:53 POSLE PODNE od Gagi_

Citat: Gagi_ poslato Decembar 04, 2012, 16:13:57 POSLE PODNE
Citat: Blaeks poslato Decembar 02, 2012, 13:42:24 POSLE PODNE
Evo jos jedna od mene, setskin : CMD:setskin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1)
{
    new id;
    new skin;
    if(sscanf(params,"ud",id,skin)) return SCM(playerid, -1, "KORISCENJE: /setskin [ID igraca] [Skin]");
else if(id == IPI) return SCM(playerid, -1, "Pogresan ID Igraca!");
else
{
SetPlayerSkin(id, skin);
new poruka[256];
format(poruka,sizeof(poruka), "Administrator vam je promenio skin u ID: %d",skin);
SCM(id, -1, poruka);
}
}
else return SCM(playerid, -1, "Nisi Admin!");
return 1;
}

Ne treba ti toliki string od 256 jer SCM i ne moze da posalje toliko karaktera.
Jedan tut koji je koristan: http://balkan-samp.com/forum/index.php?topic=10871.msg81887#msg81887

moras navest da se treba definisat ili mozes i zamenit ovo
"IPI"
sa
"INVALID_PLAYER_ID"
I jos nesto kao u ovom tut-u
i lepo pise da je je u sampu njveci output 128..
Zasto ti stavljas new poruka[256]; mad ovo nije ni vazno al aj :)


Inace pomocice pocetnicima :)
Poslednja Izmena: Decembar 04, 2012, 19:00:33 POSLE PODNE od --Lood--

Gagi_: Hvala sto si me ispravio
Lood: Stavio sam u mom proslom postu te definicije

Ta tvoja komanda je nekorisna , obicna GF

Citat: David (Sabljak) poslato Decembar 07, 2012, 18:23:32 POSLE PODNE
neka simple fakeban cmd

CMD:fakeban(playerid, params[])
{
new id,name1[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME], string[128];
if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SCM(playerid,COLOR_RED,"{B3B3B3}[{FF0000}Greska!{B3B3B3}] Niste Admin!");
if(sscanf(params,"u", id)) return SCM(playerid, COLOR_RED,"Koristi: {FFFFFF}/fakeban [Ime_Prezime/ID]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}>> [GRESKA] {FFFFFF}Krivi ID!");
else
{
  GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(id, name2, sizeof(name2));
format(string, sizeof(string), "(Fake)Ban | %s, Admin: %s ", name2, name1);
SendClientMessageToAll(COLOR_RED, string);
}
return 1;
}

U naslovu pise "Korisne komande" ,a bgm kolko ja znam ovo nije korisno! Jer nemoze biti neka komanda tipa "da beze svim igracima ispise kako je netko fejk banan" mislim nema svrhe...

ABroadCast? COLOR_LIGHTED? imas malo propusta

Citat: David (Sabljak) poslato Decembar 09, 2012, 17:50:01 POSLE PODNE
ABroadCast ili SendAdminMessage.... :P

Nema nigdje LIGHTED XD
ABroadCast(COLOR_LIGHTRED,string,1);

Evo od mene neke 3 CMD xD
sa ZCMD i sscanf

CMD:proveriip(playerid, params[])
{
new IPadresa[32];
new id;
if (sscanf(params, "i",id)) return SendClientMessage(playerid, BELA, "{00C0FF}Koriscenje:{ffffff} /proveriip [ID igraca]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Taj igrac nije na serveru");
GetPlayerIp(id, IPadresa, sizeof(IPadresa));
new str[40];
format(str, sizeof(str), "IP: %s", IPadresa);
SendClientMessage(playerid, -1, str);

return 1;
}

i cmd /idido

CMD:idido(playerid, params[])
{
new targetid;

if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Koristi:/idido [ID/Dio imena]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Igrac nije na serveru!");
SetPlayerInterior(playerid,GetPlayerInterior(targetid));
new Float:TPX, Float:TPY, Float:TPZ;
GetPlayerPos(targetid, TPX, TPY, TPZ);
SetPlayerPos(playerid, TPX, TPY, TPZ+2);

return 1;
}

i prebaci

CMD:prebaci(playerid, params[])
{

new Float:slx, Float:sly, Float:slz;
new string[90];
new igracevid;
new pName[MAX_PLAYER_NAME];
new aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, 24);
GetPlayerName(igracevid, pName, 24);
if(sscanf(params, "u", igracevid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Koristi:/prebaci [ID/Dio imena]");
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(igracevid, slx, sly, slz+2);
format(string,sizeof(string),"{FFFFFF} %s {F81414}vas je prebacio do sebe",aName);
SendClientMessage(igracevid, 0xFFFFFFAA, string);


return 1;
}




Citat: --Lood-- poslato Decembar 11, 2012, 19:10:47 POSLE PODNE
Evo od mene neke 3 CMD xD
sa ZCMD i sscanf

CMD:proveriip(playerid, params[])
{
new IPadresa[32];
new id;
if (sscanf(params, "i",id)) return SendClientMessage(playerid, BELA, "{00C0FF}Koriscenje:{ffffff} /proveriip [ID igraca]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Taj igrac nije na serveru");
GetPlayerIp(id, IPadresa, sizeof(IPadresa));
new str[40];
format(str, sizeof(str), "IP: %s", IPadresa);
SendClientMessage(playerid, -1, str);

return 1;
}

i cmd /idido

CMD:idido(playerid, params[])
{
new targetid;

if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Koristi:/idido [ID/Dio imena]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Igrac nije na serveru!");
SetPlayerInterior(playerid,GetPlayerInterior(targetid));
new Float:TPX, Float:TPY, Float:TPZ;
GetPlayerPos(targetid, TPX, TPY, TPZ);
SetPlayerPos(playerid, TPX, TPY, TPZ+2);

return 1;
}

i prebaci

CMD:prebaci(playerid, params[])
{

new Float:slx, Float:sly, Float:slz;
new string[90];
new igracevid;
new pName[MAX_PLAYER_NAME];
new aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, 24);
GetPlayerName(igracevid, pName, 24);
if(sscanf(params, "u", igracevid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Koristi:/prebaci [ID/Dio imena]");
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(igracevid, slx, sly, slz+2);
format(string,sizeof(string),"{FFFFFF} %s {F81414}vas je prebacio do sebe",aName);
SendClientMessage(igracevid, 0xFFFFFFAA, string);


return 1;
}


U komandi /proveriip promeni ovo "BELA"(možda neko nema definisano)

if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Taj igrac nije na serveru"); od ove linije mi se sere