SA-MP Forums Archive
Lil' script prob - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Lil' script prob (/showthread.php?tid=335224)



Lil' script prob - ikbenremco - 17.04.2012

Sup guys,
I was creating a /aduty command for my cops and robber server,
but the playername isnt giving


Код:
ADMIN [Playername] is now [OFF] admin duty
String :
No errors.
Код:
format(string, 200, "ADMIN %s(%d) is now [OFF] admin duty", pname, playerid);
Ingame :

It isnt giving the name of the admin :S

Full command :

Код:
cmd(aduty, playerid, params[])

{
    new ID; new string[120]; new pname[240];
	if(GetPVarInt(playerid, "AdminLevel") == 0) return 0;
	if(GetPVarInt(playerid, "AdminMode") == 1)
	{
	    SetPlayerHealth(playerid, 100);
		SetPlayerArmour(playerid, 100);
		ResetPlayerWeapons(playerid);
		GivePlayerTeamWeapons(playerid);
		SetPlayerColor(playerid, 0xFAFAFAFF);
		SetPlayerSkin(playerid, 115);
        format(string, 200, "ADMIN %s(%d) is now [OFF] admin duty", pname, playerid);
		SendClientMessageToAll(COLOR_ADMIN, string);
		SetPVarInt(playerid, "AdminMode", 0);
		return 1;
	}
Hope you guys can help me


Re: Lil' script prob - AlTy - 18.04.2012

You need to use this: https://sampwiki.blast.hk/wiki/GetPlayerName not just pname


Re: Lil' script prob - DBan - 18.04.2012

pawn Код:
new ID; new string[120]; new pname[240];
lol? First off, why would you make pname's length 240? The max amount of characters you can have in a player name is 24. Second, you didn't even get the player's name, follow the link in the above post.


Re: Lil' script prob - ikbenremco - 18.04.2012

Fixed.