A tiny bit of help please
#1

My error is


Код:
(1050) : error 017: undefined symbol "Name"
Im trying to make a jail command


Код:
stock PlayerName(playerid)
      {
        new pName[25];
        GetPlayerName(playerid, pName, sizeof(pName));
        return pName;
      }
Код:
CMD:jail(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
            new targetid, minutes; //define the player's name and the minutes of jailing
            if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_RED,"Usage: /jail <playerid> <minutes>"); //detects the wrong params and show the usage
            if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_RED, "Minutes can't be less than 0 or more than 60!"); //we won't let a player suffer more than 1 hour, and not less than 1 minute
            if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!"); //comment this line out, if you wanna test this command on yourself!
            if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!"); //the performer can't jail higher admins!
            else
            {
                new str[128]; //create a new string
                format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes); //get the admin's name, the player's and show the minutes
                SendClientMessageToAll(COLOR_LIGHTBLUE,str); //let everybody know what you did, this will send the message to everyone
                JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false); //now HERE we're setting the jailtimer from the variable created, it will calculate the milliseconds to seconds, multiplicated with the amount of minutes we gave
                SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391); //Sets the player's position to the jail in LS
        SetPlayerInterior(playerid, 6); //this will set the player's interior to an jail-interior
        inJail[targetid] = true; //now, here we'll check, if the player's in jail, we'll set the value to "true", means that he IS in jail
        GameTextForPlayer(playerid, "~p~JAILED", 10000, 6); //this is for decorating and writing a big "JAILED" for the player
        PlayerPlaySound(targetid,1057,0.0,0.0,0.0); //that's also a small sound, for decoration
        }
    }
        else return SendClientMessage(playerid, COLOR_RED, "You have to be level 4 to use this command!"); //if he isn't allowed to use this command, send him this message
        return 1;
    }
Please Help Me
Reply
#2

pawn Код:
, Name(playerid), Name(targetid)
should be

pawn Код:
, PlayerName(playerid), PlayerName(targetid)

next time use pawn tags not code tags
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)