Admin command help D:
#1

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

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

EDIT: Nevermind, user above was faster.
Reply
#4

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

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:
Reply
#6

You missed the respawn_delay parameter, see CreateVehicle
Reply
#7

i did i added it now but it still have it ..
Edit:i solved it thanks : DD
Reply
#8

My bad sorry, also you forget the "angle" parameter! Check the wiki website I gave you above to see the whole function parameters.
Reply
#9

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?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)