convert this command to strcmp - 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: convert this command to strcmp (
/showthread.php?tid=421409)
convert this command to strcmp -
NewbieScripter - 09.03.2013
how to convert this command in strcmp ?
Код:
CMD:joinrace(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000, "Please enter a race id to join or type /races");
new raceid = strval(params);
if(raceid > currentraceslot-1) return SendClientMessage(playerid, 0xFF0000, "The race ID you have entered is invalid");
if(RaceInfo[raceid][racejoinable] == false && RaceInfo[raceid][racerunning] == false && InRace[playerid] == -1) OpenRace(raceid);
JoinRace(playerid, raceid);
return 1;
}
Код:
error 017: undefined symbol "params"
Re: convert this command to strcmp -
LarzI - 09.03.2013
Why not use get zcmd and learn to use it?
Anyway..:
pawn Код:
if( !strcmp( cmdtext, "/joinrace", true ))
{
if( !cmdtext[ 10 ] || cmdtext[ 10 ] == '\1' )
return SendClientMessage(playerid, 0xFF0000, "Please enter a race id to join or type /races");
new
raceid = strval( cmdtext[ 10 ] );
if(raceid > currentraceslot-1)
return SendClientMessage(playerid, 0xFF0000, "The race ID you have entered is invalid");
if(RaceInfo[raceid][racejoinable] == false && RaceInfo[raceid][racerunning] == false && InRace[playerid] == -1)
OpenRace(raceid);
JoinRace(playerid, raceid);
return 1;
}
Re: convert this command to strcmp -
NewbieScripter - 09.03.2013
because i have only 3 commands... thanks
Re: convert this command to strcmp -
LarzI - 09.03.2013
Quote:
Originally Posted by NewbieScripter
because i have only 3 commands...
|
Well then you have a hell of a starting point to learn ZCMD before you have 8912378937 commands and need to convert them. Trust me, it is really really easy to learn.
Re: convert this command to strcmp -
NewbieScripter - 09.03.2013
Quote:
Originally Posted by LarzI
Why not use get zcmd and learn to use it?
Anyway..:
pawn Код:
if( !strcmp( cmdtext, "/joinrace", true )) { if( !cmdtext[ 10 ] || cmdtext[ 10 ] == '\1' ) return SendClientMessage(playerid, 0xFF0000, "Please enter a race id to join or type /races"); new raceid = strval( cmdtext[ 10 ] ); if(raceid > currentraceslot-1) return SendClientMessage(playerid, 0xFF0000, "The race ID you have entered is invalid"); if(RaceInfo[raceid][racejoinable] == false && RaceInfo[raceid][racerunning] == false && InRace[playerid] == -1) OpenRace(raceid); JoinRace(playerid, raceid); return 1; }
|
EDIT: The command dosen't work..
RE-EDIT.. solved