Help with /mask - 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: Help with /mask (
/showthread.php?tid=303225)
Help with /mask -
Azzeto - 12.12.2011
Hey, i'v never created a mask system before and heres my code.
PHP код:
CMD:mask(playerid,params[])
{
new pName[MAX_PLAYER_NAME],Masked;
new oldname = GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked == 0)
{
SetPlayerName(playerid,"Masked Person");
SendClientMessage(playerid,COLOR_WHITE,"You've put a mask on.");
Masked = 1;
}
else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked == 1)
{
SetPlayerName(playerid,oldname);
Masked = 0;
}
return 1;
}
And the SetPlayerName(playerid,oldname); says like
Код:
C:\Documents and Settings\Customer\Desktop\Linux-Server\gamemodes\vx-rp.pwn(9339) : error 035: argument type mismatch (argument 2)
So How would I get their name, before the do /mask, and reuse there name under SetPlayerName(playerid,oldname); again
Re: Help with /mask -
THE_KNOWN - 12.12.2011
pawn Код:
new Masked[MAX_PLAYERS]; // must be global array
new oldname[MAX_PLAYERS][MAX_PLAYER_NAME];// global again
CMD:mask(playerid,params[])
{
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked[playerid] == 0)
{
GetPlayerName(playerid,oldname[playerid],MAX_PLAYER_NAME);
SetPlayerName(playerid,"Masked_Person");//spaces not allowed
SendClientMessage(playerid,COLOR_WHITE,"You've put a mask on.");
Masked[playerid] = 1;
}
else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked[playerid] == 1)
{
SetPlayerName(playerid,oldname[playerid]);
Masked[playerid] = 0;
}
return 1;
}
Edit: fixed a few lines. thanks to the posted below
Re: Help with /mask - suhrab_mujeeb - 12.12.2011
Quote:
Originally Posted by THE_KNOWN
pawn Код:
new Masked[MAX_PLAYERS]; // must be global array
new oldname[MAX_PLAYERS];// global again
CMD:mask(playerid,params[]) { if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked[playerid] == 0) { GetPlayerName(playerid,oldname,MAX_PLAYER_NAME); SetPlayerName(playerid,"Masked_Person");//spaces not allowed SendClientMessage(playerid,COLOR_WHITE,"You've put a mask on."); Masked[playerid] = 1; } else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 && playerVariables[playerid][pGroup] != 0 && Masked[playerid] == 1) { SetPlayerName(playerid,oldname); Masked[playerid] = 0; } return 1; }
|
Shouldn't it be oldname[MAX_PLAYERS][MAX_PLAYER_NAME];
Example:
https://sampforum.blast.hk/showthread.php?tid=287244
Re: Help with /mask -
Azzeto - 12.12.2011
Ok but, how come they still see my name over my head