Mask for donaters -
Galcio - 30.11.2009
Hello, I'm trying to make a system allowing masks for free whenever the player wants to use it. This is the mask script I'm using:
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have a mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not at the required level to use this command");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, "[Info:] You have put your mask on");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s puts a mask on", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
I've come with far:
pawn Код:
if(strcmp(cmd, "/dmask", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have a mask");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, "[Info:] You have put your mask on");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s puts a mask on", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
I appreciate any helpful answers.
Re: Mask for donaters -
dice7 - 30.11.2009
And what's wrong ?
Also, for showing the name tags again, the third parameter in ShowPlayerNameTagForPlayer must be set to true (1)
https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer
Re: Mask for donaters -
Galcio - 30.11.2009
The problem is that I want it to only be possible for donaters to use this command: /dmask. But as it is like now, it's possible for everyone.
Basically I just need help with modifying this command to only work for donators:
pawn Код:
if(strcmp(cmd, "/dmask", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have a mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not at the required level to use this command");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, "[Info:] You have put your mask on");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s puts a mask on", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
I've tried now for an hour or more, without any success. Thank you.
Re: Mask for donaters -
lolumadd - 30.11.2009
Change
pawn Код:
ShowPlayerNameTagForPlayer(i, playerid, 0);
To
pawn Код:
ShowPlayerNameTagForPlayer(playerid, i, 0);
Re: Mask for donaters -
Galcio - 30.11.2009
Thanks for your attempt to help me, but that's not the problem..
As I said before, I want this /dmask command only to be able for donators. I'm using the SAGC script (
http://forum.sa-mp.com/index.php?topic=126113.0). Shouldn't I put like
pawn Код:
if(PlayerInfo[playerid][pDonator]
somewhere? I'm not sure if that's right, just a wild guess.
Re: Mask for donaters -
[NYRP]Mike. - 30.11.2009
pawn Код:
if(strcmp(cmd, "/dmask", true) == 0)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pDonator] == 1)
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have a mask");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(playerid, i, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, "[Info:] You have put your mask on");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s puts a mask on", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
Re: Mask for donaters -
Galcio - 30.11.2009
Yay, almost. The command itself works only for donators now. But I also would like it to be free for them. They should automatically get one as soon they type /dmask or something. I hope you understand what I'm trying to say.
Thanks for the help!
FIXED!