SA-MP Forums Archive
Why won't this work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why won't this work? (/showthread.php?tid=335777)



Why won't this work? - HazardGaming - 19.04.2012

Код:
CMD:jail(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 4)
        {
            new targetid, minutes;
            if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_RED,"Usage: /jail <playerid> <minutes>");
            if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_RED, "Minutes can't be less than 0 or more than 60!");
            if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!");
            if(PlayerInfo[targetid][pAdminLevel] > PlayerInfo[playerid][pAdminLevel]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!");
            else
            {
                new str[128];
                format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes);
                SendClientMessageToAll(COLOR_RED,str);
                JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false); 
                SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
        SetPlayerInterior(playerid, 6);
        inJail[targetid] = true; 
        GameTextForPlayer(playerid, "~p~JAILED", 10000, 6);
        PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
        }
    }
        else return SendClientMessage(playerid, COLOR_RED, "You have to be level 4 to use this command!");
        return 1;
}
Errors:
Код:
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Untitled.pwn(280) : error 017: undefined symbol "Name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
and I have this
Код:
stock GetName(playerid)
{
	new
		Name[24];
	GetPlayerName(playerid, Name, 24);
	return Name;
}



Re: Why won't this work? - IstuntmanI - 19.04.2012

Change Name( from command with GetName( .


Re: Why won't this work? - AndreT - 19.04.2012

Your function is called GetName, not Name... So change it to "GetName", however I seriously suggest you not to use this sort of a "shortcut".