[POMOC] Slap

Započeo Danisha, Septembar 08, 2012, 11:18:35 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:Ravens
Detaljan opis problema:Kako da napravim nemogu nikog da slapujem don ne npisem razlog npr /slap ID razlog
Dio skripte:
if(strcmp(cmd, "/slap", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /slap [playerID/DeoImena]");
return 1;
}
new playa;
    new Float:slx, Float:sly, Float:slz;
playa = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1  || IsPlayerAdmin(playerid) || PlayerInfo[playerid][pGameMaster] >= 1)
{
    if(IsPlayerConnected(playa))
    {
        if(playa != INVALID_PLAYER_ID)
        {
            new targetlevel = PlayerInfo[playa][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not ban People that is higher Than You!");
                        if(playa != playerid && Untouchable[playa]) return SendClientMessage(playerid, COLOR_GREY, "* You Can't Do this on This player!");
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerPos(playa, slx, sly, slz);
SafeSetPlayerPos(playa, slx, sly, slz+8);
PlayerPlaySound(playa, /*1130*/1190, slx, sly, slz+8);
printf("[SLAP]: %s je slapovao igraca %s",sendername,  giveplayer);
format(string, sizeof(string), "[SLAP]: %s je slapovan od strane %s",giveplayer ,sendername);
BroadCast(COLOR_LIGHTRED,string);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Slapped %s.",d,m,y,h,mi,s,sendername,giveplayer);
SlapLog(string);
format(string, sizeof(string), "[ADMIN]: %s has Slapped %s (%d).",sendername, giveplayer, playa);
ABroadCast(COLOR_LIGHTRED,string, 5);
GameTextForPlayer(playa, "~r~Slapped!",5000,3);
format(string, sizeof(string), "** You have Successfuly Slapped %s (%d)", giveplayer, playa);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** Niste ovlasceni da koristite tu komandu!");
}
}
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno):

Evo ti probaj ovako
if(strcmp(cmd, "/slap", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /slap [playerID/DeoImena] [Reason]");
return 1;
}
new playa;
    new Float:slx, Float:sly, Float:slz;
playa = ReturnUser(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /slap [playerID/DeoImena] [Reason]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 1  || IsPlayerAdmin(playerid) || PlayerInfo[playerid][pGameMaster] >= 1)
{
    if(IsPlayerConnected(playa))
    {
        if(playa != INVALID_PLAYER_ID)
        {
            new targetlevel = PlayerInfo[playa][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not ban People that is higher Than You!");
                        if(playa != playerid && Untouchable[playa]) return SendClientMessage(playerid, COLOR_GREY, "* You Can't Do this on This player!");
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerPos(playa, slx, sly, slz);
SafeSetPlayerPos(playa, slx, sly, slz+8);
PlayerPlaySound(playa, /*1130*/1190, slx, sly, slz+8);
printf("[SLAP]: %s je slapovao igraca %s",sendername,  giveplayer);
format(string, sizeof(string), "[SLAP]: %s je slapovan od strane %s",giveplayer ,sendername);
BroadCast(COLOR_LIGHTRED,string);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Slapped %s,reason: %s.",d,m,y,h,mi,s,sendername,giveplayer,(result));
SlapLog(string);
format(string, sizeof(string), "[ADMIN]: %s has Slapped %s (%d),reason: %s.",sendername, giveplayer, playa,(result));
ABroadCast(COLOR_LIGHTRED,string, 5);
GameTextForPlayer(playa, "~r~Slapped!",5000,3);
format(string, sizeof(string), "** You have Successfuly Slapped %s (%d),reason: %s", giveplayer, playa,(result));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** Niste ovlasceni da koristite tu komandu!");
}
}
return 1;
}

Zasto koristite strmp kad je mnogo lakse ZCMD + sscanf.
ODSUTAN


Nikola hvala ti radi sve ok
a i ja bi da prebacim ali neznam u taj drugi vrag sto govori daniel ali i treba svaku komandu posebno a neisplati mi se ode mi dugo vremena

Ma znam znam brate ali kad bi imo nekoga da mi sve prebaci u zcmd bio bi nagradjen na mome serveru 1337