28.03.2011, 17:48
Hy everybody.
I am new to ZCMD but I wan't to use it because it looks more simple than "onplayercommand function."
So I wrote a code for a job, something like Truck driver.
So basicly, this code allow you to choose which route to drive. The code works that is not problem.
I have some questions. Can I short(make a smaller) this code or this is apsoloutly correct?
"if(sscanf(params,"i",s))" - sscanf returns 0 at succes?
thank you, and any advice is welcome.
I am new to ZCMD but I wan't to use it because it looks more simple than "onplayercommand function."
So I wrote a code for a job, something like Truck driver.
Код:
CMD:materijal(playerid, params[]) { new carid=GetPlayerVehicleID(playerid); new s; if(sscanf(params,"i",s)) return SendClientMessage(playerid, COLOR_GRAD2, "UPOTREBA: /materijal [1 ili 2]"); if(!(IsAPrevoznikCar(carid))) return SendClientMessage(playerid, COLOR_GRAD3, "You are not in right vehicle!"); else if(s>2) return SendClientMessage(playerid, COLOR_GRAD2, "Not valid choice!"); if(s==1) { SetPlayerCheckpoint(playerid, -1060.0957,-593.9825,31.8627,5.0);//cp CP[playerid] = 20; } else if(s==2) { SetPlayerCheckpoint(playerid, -1060.0957,-593.9825,31.8627,5.0);//cp CP[playerid] = 25; } return 1; }
I have some questions. Can I short(make a smaller) this code or this is apsoloutly correct?
"if(sscanf(params,"i",s))" - sscanf returns 0 at succes?
thank you, and any advice is welcome.