SA-MP Forums Archive
werid problem. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: werid problem. (/showthread.php?tid=217498)



werid problem. - Haydz - 28.01.2011

Hey guys, When i type /setcallsign it only allows me to put 2 characters after it. although i can put four characters after it put it shows "Invaild command", so i'v missed out a return 1 somewhere. the callsign is meant to be 8 characters and it saves to the database perfectly.

pawn Код:
//you can use this to check your current call-sign
command(mycallsign,playerid, params[])
{
    new string[70];
    format(string,sizeof(string),"Your callsign is - %s",PlayerInfo[playerid][CallSign]) && SendClientMessage(playerid, COLOR_WHITE,string);
    return 1;
}
//how you set your new call sign,
command(setcallsign,playerid, params[])
{
    new SetCallSign;
    if(sscanf(params, "s[15]", SetCallSign)) return SendClientMessage(playerid, COLOR_ORANGE,"USAGE: /setcallsign [New Call Sign]");
    else
    {
        new Query[70]; format(Query, sizeof(Query), "UPDATE users SET CallSign = '%s' WHERE username = '%s'",PlayerInfo[playerid][CallSign],GetName(playerid));
        mysql_query(Query);
        new string[50];
        format(string,sizeof(string),"You have set your new Call Sign to - %s",SetCallSign) && SendClientMessage(playerid, COLOR_WHITE,string);
    }
    return 1;
}
Thanks in advance.


Re: werid problem. - mick88 - 28.01.2011

Variable SetCallSign should be an array in command(setcallsign,playerid, params[])

pawn Код:
new SetCallSign[15];



Re: werid problem. - Haydz - 28.01.2011

Cheers mick, should have though of that, works like a charm.