21.09.2013, 18:52
Hello
I made a race system a while ago and it has this command to start or join races: /joinrace <id>
However I wanna change it to: /joinrace <racename>
So here's what I tried doing:
So I loop through all the races and then compare their name with the params, however for some reason for every name I type after /joinrace it always calls the race with raceid 0....
Do you know what could be wrong?
Thanks in advance
I made a race system a while ago and it has this command to start or join races: /joinrace <id>
However I wanna change it to: /joinrace <racename>
So here's what I tried doing:
pawn Код:
CMD:joinrace(playerid, params[])
{
JoinRace(playerid, raceid);*/
new name[56], raceid;
if(PInfo[playerid][VortexJump] == 1 ) return SendClientMessage(playerid,COLOR_RED,"You cannot use this command here, finish your jump please");
if(sscanf(params,"s[56]",name)) return SendClientMessage(playerid, COLOR_RED, "Invalid race name");
for(new x = 0;x<currentraceslot; x++)
{
if(!strcmp(RaceInfo[x][racename], name, false))
{
raceid = x;
}
//break;
}
if(raceid == 0) return SendClientMessage(playerid, COLOR_RED, "Invalid race name");
if(RaceInfo[raceid][racejoinable] == false && RaceInfo[raceid][racerunning] == false && PInfo[playerid][Racing] == -1) OpenRace(raceid);
JoinRace(playerid, raceid);
SendClientMessage(playerid, COLOR_GREEN, "racename called");
return 1;
}
Do you know what could be wrong?
Thanks in advance
