SA-MP Forums Archive
my cmd doesnt work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: my cmd doesnt work (/showthread.php?tid=351312)



my cmd doesnt work - thefatshizms - 15.06.2012

here is my cmd:
pawn Код:
CMD:test(playerid, params[])
{
    new id;
    new reason[128];
    new kick[128];
    new kickmsgtoadmin[128];
    new name[MAX_PLAYER_NAME];
    if(PInfo[playerid][Padmin] > 0)
    {
        if(sscanf(params,"uc",id,reason)) return SendClientMessage(playerid, -1, "UAGE: /kick <id> <reason>");
        GetPlayerName(id,name,sizeof(name));
        format(kick, sizeof(kick), "you have been kicked by %s for reason: %c", name, reason);
        SendClientMessage(id, ORANGE, kick);
        format(kickmsgtoadmin, sizeof(kickmsgtoadmin), "you have kicked %s for reason: %c", name, reason);
        SendClientMessage(playerid, -1, kickmsgtoadmin);
        Kick(id);
    } return true;
}
it just shows SERVER:unkown cmd


Re: my cmd doesnt work - Djole1337 - 15.06.2012

Weird... it works for me : o

http://puu.sh/B9Cy

http://puu.sh/B9Cw


Re: my cmd doesnt work - Kindred - 15.06.2012

Is there a sort of return 0; somewhere near the command that could prevent the command from being processed?


Re: my cmd doesnt work - thefatshizms - 15.06.2012

there is no return 0; btw how do i make that u can make the reason longer?


Re: my cmd doesnt work - Elysian` - 15.06.2012

pawn Код:
new reason[128];
To;
pawn Код:
new reason[Reason length in here.];



Re: my cmd doesnt work - thefatshizms - 15.06.2012

yeh i know that lol but like what i put in the sscanf line a 'd' or 'i' etc

p.s cmd still doesnt work


Re: my cmd doesnt work - Face9000 - 15.06.2012

Why you're using %c ?

You can use %s for playername and %d for playerid.


Re: my cmd doesnt work - thefatshizms - 15.06.2012

i know that lol

ok btw i removed the if(PInfo[playerid][Padmin] > 0) and it seemed to work.... but i need that as i only want admins to use it

and with %c it only ables me to do 1 letter in reason D;


Re: my cmd doesnt work - Face9000 - 15.06.2012

pawn Код:
if(PInfo[playerid][Padmin] == 0) return SendClientMessage(playerid,0xFF0000FF,"This command is allowed only for admins.");
Place it before executing the command.


Re: my cmd doesnt work - thefatshizms - 15.06.2012

thanks thats sorted out the admin bit, what about the one letter reason?