convert this command to strcmp
#1

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"
Reply
#2

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;
}
Reply
#3

because i have only 3 commands... thanks
Reply
#4

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.
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)