07.05.2013, 10:33
(
Последний раз редактировалось jordy.kiesebrink; 15.05.2013 в 12:02.
)
Dear users,
I have a question for you, I am working on a server and i'm stuck with making a command with optional paraments. I work with the zcmd proccesor and sscanf currently and I would like to make some commands with a double function.
For example I want to have a /nos command wich I already made but I want it so that a player types /nos it will give the playerid nos on his vehicle but if the player types /nos [playerid] it gives the enetered playerid (the targetid) nos on his vehcile.
so far so good this is my /nos command, now I can copy this and make a /givenos and change the playerid into a targetid but this is not what i want!
Becouse I know sscanf does have the optional parameters called "U" but I am stuck with setting this on a command becouse it needs a switch with the AddVehicleComponent I guess becouse when the player does not give a playerid after the /nos it needs to set the AddVehicleComponent on the playerid, but when they give a targetid it needs to add a AddVehicleComponent on the target
I hope you guys understand what I mean and I hope you could help me.
Kind regarts Jordy
I have a question for you, I am working on a server and i'm stuck with making a command with optional paraments. I work with the zcmd proccesor and sscanf currently and I would like to make some commands with a double function.
For example I want to have a /nos command wich I already made but I want it so that a player types /nos it will give the playerid nos on his vehicle but if the player types /nos [playerid] it gives the enetered playerid (the targetid) nos on his vehcile.
so far so good this is my /nos command, now I can copy this and make a /givenos and change the playerid into a targetid but this is not what i want!
Becouse I know sscanf does have the optional parameters called "U" but I am stuck with setting this on a command becouse it needs a switch with the AddVehicleComponent I guess becouse when the player does not give a playerid after the /nos it needs to set the AddVehicleComponent on the playerid, but when they give a targetid it needs to add a AddVehicleComponent on the target
pawn Код:
COMMAND:nos(playerid,params[]) {
if(CheckARank(playerid, 4, 4)) { //nothing special this is my admin check for the admin script im working on.
if(IsPlayerInAnyVehicle(playerid)){ //checks if the player id is in a vehicle
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); //adds the nos on the vehicle
SendClientMessage(playerid, COLOR_GREEN, "(SUCCES!) Succesfully installed Nitro x10"); //send a message when the nos is added
} else {
SendClientMessage(playerid, COLOR_RED, "(ERROR!) You can not attach nitro on your player, you need to be in a vehicle!"); //send a message when the player is not in a vehicle
}
}
return 1;
}
Kind regarts Jordy