Admin command help D: -
vassilis - 02.11.2011
hey guys what is the problem in this admin command because i got 9 warnings :P actually how i will make a vehicle front of the player who asked it btw here is the command and tell me what is wrong D:
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR:Only Admins can use this command for cars /carmenu!");
if(strcmp(cmd,"/nrg", true) ==0){
if(IsPlayerInAnyVehicle(playerid))
SendClientMessage(playerid, COLOR_RED, "ERROR:You are already in a vehicle..!");
else
{
new vehicleid= GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(522, x,y,z,0,0);
SetVehiclePos(vehicleid, GetPlayerPos(playerid));
PutPlayerInVehicle(playerid, 522,0);
SendClientMessage(playerid, COLOR_YELLOW, "Your Personal Nrg has been created!");
GameTextForPlayer(playerid, "~w~personal ~b~n~g~r~p~g ~w~ is ~y~created~w~!!!",3000,5);
}
Re: Admin command help D: -
KaleOtter - 02.11.2011
GetPlayerPos should be like this:
new Float

, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(vehicleid, x,y,z);
PutPlayerInVehicle(playerid, 522,0); should be: PutPlayerInVehicle(playerid, vehicleid,0);
Re: Admin command help D: -
SmiT - 02.11.2011
EDIT: Nevermind, user above was faster.
Re: Admin command help D: -
SuperViper - 02.11.2011
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR:Only Admins can use this command for cars /carmenu!");
if(strcmp(cmd, "/nrg", true) == 0){
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are already in a vehicle..!");
else {
new vehicleid;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
vehicleid = CreateVehicle(522, x, y, z, 0, 0, 900);
PutPlayerInVehicle(playerid, vehicleid, 0);
SendClientMessage(playerid, COLOR_YELLOW, "Your Personal Nrg has been created!");
GameTextForPlayer(playerid, "~w~personal ~b~n~g~r~p~g ~w~ is ~y~created~w~!!!",3000,5);
}
}
Re: Admin command help D: -
vassilis - 02.11.2011
ye it helped me but what about this line:
pawn Код:
CreateVehicle(522,x,y,z,0,0);
warnings:
pawn Код:
number of arguments does not match definition D:
Re: Admin command help D: -
SmiT - 02.11.2011
You missed the respawn_delay parameter, see
CreateVehicle
Re: Admin command help D: -
vassilis - 02.11.2011
i did i added it now but it still have it ..
Edit:i solved it thanks : DD
Re: Admin command help D: -
SmiT - 02.11.2011
My bad sorry, also you forget the "angle" parameter! Check the wiki website I gave you above to see the whole function parameters.
Re: Admin command help D: -
vassilis - 02.11.2011
i also added thx btw smit.One more question how i will make a command with id for example how i can make a kick command?
Re: Admin command help D: -
Kostas' - 02.11.2011
pawn Код:
CMD:kick(playerid, params[])
{
new giveid, reason[128];
if(PData[playerid][Level] < 2) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to perform this command.");
else if(sscanf(params, "rs[128]", giveid, reason)) return SCM(playerid, yellow, "SYNTAX: /kick <name/id> <reason>");
else if(giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[ERROR] That player isn't online!");
else
{
if(PData[giveid][Level] == 0)
{
new name2[MAX_PLAYER_NAME];
GetPlayerName(giveid, name2, sizeof(name2));
GetPlayerName(playerid, pname, sizeof(pname));
format(str2, sizeof(str2), "%s was kicked by an Administrator. (REASON: %s)", name2, reason);
MessagePlayers(red, str2);
format(str2, sizeof(str2), "%s was kicked by %s. (REASON: %s)", name2, pname, reason);
MessageAdmins(red, str2);
format(str3, sizeof(str3),"{FFFFFF}Kick information:\r\n{FF0000}Kicked by:{FFFFFF} %s\r\n{FF0000}Reason:{FFFFFF} %s\r\n{FFFFFF}Feel free to rejoin!", pname, reason);
ShowPlayerDialog(giveid, 13337, DIALOG_STYLE_MSGBOX, "{FF0000}You have been kicked.", str3, "Close", "");
Kick(giveid);
}
}
return 1;
}
pawn Код:
if(PData[giveid][Level] == 0)
Admins cannot be kicked, it shows only the message