/mask doesnt work properly - 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: /mask doesnt work properly (
/showthread.php?tid=318493)
/mask doesnt work properly -
BleverCastard - 15.02.2012
Can someone help me with this, it doesn't change there name back. It switches to a new name:
Say if its Masked_19, If you type /mask again it would switch to Masked_23.
Код:
new isMasked[MAX_PLAYERS];
new OldUsername[MAX_PLAYER_NAME][MAX_PLAYERS];
Код:
CMD:mask(playerid, params[]) {
if(playerVariables[playerid][pGroup] != 7) {
if(isMasked[playerid] == 0) {
new randomID = random(200);
new string[35];
GetPlayerName(playerid, string, sizeof(string));
strmid(OldUsername[playerid], string, 0, strlen(string), 64);
format(string,sizeof(string), "Masked_%d", randomID);
SetPlayerName(playerid, string);
SendClientMessage(playerid, COLOR_GREY, "You have put on a mask! (/mask to disable)");
}
else return SendClientMessage(playerid, COLOR_GREY, "You do now have the right privillages to use this command.");
}
else
{
SetPlayerName(playerid, OldUsername[playerid]);
isMasked[playerid] = 1;
SendClientMessage(playerid, COLOR_GREY, "You have taken off your mask!");
}
return 1;
}
Re: /mask doesnt work properly -
[MG]Dimi - 15.02.2012
pawn Код:
CMD:mask(playerid, params[])
{
//I guess only Team 7 can use it. Line below this one is set that only Team 7 can use it. If you want that everyone except 7 ca use it
// replace != 7 with == 7
if(playerVariables[playerid][pGroup] != 7) return SendClientMessage(playerid, COLOR_GREY, "You do not have the right privillages to use this command.");
if(isMasked[playerid] == 0)
{
new randomID = random(200);
new string[35];
isMasked[playerid] = 1;//Now you set that player has mask
GetPlayerName(playerid, string, sizeof(string));
strmid(OldUsername[playerid], string, 0, strlen(string), 64);
format(string,sizeof(string), "Masked_%d", randomID);
SetPlayerName(playerid, string);
SendClientMessage(playerid, COLOR_GREY, "You have put on a mask! (/mask to disable)");
}
else
{
SetPlayerName(playerid, OldUsername[playerid]);
isMasked[playerid] = 0;//here it has to be 0, not 1 because he took his mask off. Also I indentet your code a bit better
SendClientMessage(playerid, COLOR_GREY, "You have taken off your mask!");
}
return 1;
}
Your confusion. Read comment lines inside script. Have fun.
Re: /mask doesnt work properly -
BleverCastard - 15.02.2012
Thanks Dimi, but it still changes to a different name
Re: /mask doesnt work properly -
BleverCastard - 15.02.2012
FIXED.
Re: /mask doesnt work properly -
ComiGF - 15.02.2012
Can lock this
Re: /mask doesnt work properly -
BleverCastard - 15.02.2012
Why comment when I said it's fixed, Obviously a mod will lock it and delete it.