PDA

View Full Version : Mask Problem


Akcent_Voltaj
05/10/2012, 06:20 PM
look i want to type /mask to put hitmans mask on/off...i cant make it..work properly please help +REP!

if (strcmp(cmd, "/mask", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
if(PlayerInfo[playerid][pMaskuse] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, " Ti-ai pus masca!");
GetPlayerName(playerid, sendername, sizeof(sendername));
}
else
{
ShowPlayerNameTagForPlayer(i,playerid, 1);
PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
GetPlayerName(playerid, sendername, sizeof(sendername));
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu esti Hitman !");
return 1;
}
}

xMCx
05/10/2012, 07:14 PM
u dont get any errors?

Akcent_Voltaj
05/10/2012, 07:51 PM
no.errors.just doesent work..please help me fix it!

Red_Dragon.
05/10/2012, 08:00 PM
Maybe put return 0;Down

clarencecuzz
05/10/2012, 08:07 PM
Give this a shot.
if(strcmp(cmdtext, "/mask", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
if(PlayerInfo[playerid][pMaskuse] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, " Ti-ai pus masca!");
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i,playerid, 1);
}
}
PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
}
}
else return SendClientMessage(playerid, COLOR_GRAD2, " Nu esti Hitman !");
return 1;
}

You were not closing the loop, and it would have caused a few spamming errors and others.

StreetGT
05/10/2012, 08:28 PM
you must use OnPlayerStreamIn too.

Use this:


public OnPlayerStreamIn(playerid, forplayerid)
{
if(PlayerInfo[playerid][pMaskuse] >= 1)
{
ShowPlayerNameTagForPlayer(forplayerid, playerid, false);
}
return 1;
}

Red_Dragon.
05/10/2012, 09:10 PM
I suggest this: http://forum.sa-mp.com/showthread.php?t=327607

Akcent_Voltaj
06/10/2012, 08:00 AM
Give this a shot.

if(strcmp(cmdtext, "/mask", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
if(PlayerInfo[playerid][pMaskuse] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, " Ti-ai pus masca!");
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i,playerid, 1);
}
}
PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
}
}
else return SendClientMessage(playerid, COLOR_GRAD2, " Nu esti Hitman !");
return 1;
}

You were not closing the loop, and it would have caused a few spamming errors and others.


only a thing happens it just takes off mask..doesent put it on..

PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");only this works..

~Pawno~
06/10/2012, 08:02 AM
Try This ;


if(strcmp(cmd, "/maskon", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "** You don't have a mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GRAD1, "** You are not able to use it.");
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, "** You have put your mask on [/maskoff to put it away].");
format(string, sizeof(string), "* %s puts a mask on.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskon",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
return 1;
}
if(strcmp(cmd, "/maskoff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have a mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not able to use it.");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 1);
}
}
PlayerInfo[playerid][pMaskuse] = 0;
PlayerInfo[playerid][pMaskReplacement] = 0;
SendClientMessage(playerid, COLOR_WHITE, "HINT:[/maskon to use your mask!].");
GameTextForPlayer(playerid,"You have removed your mask!",5000,5);
format(string, sizeof(string), "* %s puts a mask away.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskoff",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
return 1;
}



And For The Mask Off ;


if(strcmp(cmd, "/maskoff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have a mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not able to use it.");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 1);
}
}
PlayerInfo[playerid][pMaskuse] = 0;
PlayerInfo[playerid][pMaskReplacement] = 0;
SendClientMessage(playerid, COLOR_WHITE, "HINT:[/maskon to use your mask!].");
GameTextForPlayer(playerid,"You have removed your mask!",5000,5);
format(string, sizeof(string), "* %s puts a mask away.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskoff",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
return 1;
}

Akcent_Voltaj
06/10/2012, 08:13 AM
i want with /mask.to put on mask and take it off..:(( theres no way..

Akcent_Voltaj
06/10/2012, 08:31 AM
anyone help??/mask to put it on and to take it off please..

~Pawno~
06/10/2012, 08:55 AM
Like This;


I Gave You System Too See Who Are Masked ppl too ;)



if(strcmp(cmd, "/mask", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] != 8 && PlayerInfo[playerid][pMember] != 7 && PlayerInfo[playerid][pMember] != 2)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a member of the CIA / Hitman Agency / FBI!");
return 1;
}
if(HasBoughtMask[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You don't have a mask.");
return 1;
}
if(PlayerInfo[playerid][pMask] == 0)
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMask] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s has put a mask on.", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else if(PlayerInfo[playerid][pMask] == 1)
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 1);
}
}
PlayerInfo[playerid][pMask] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s has put their mask away.", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
}
return 1;
}
if(strcmp(cmd, "/listmasked", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "Players who are masked:");
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMask] == 1)
{
format(string, sizeof(string), "- %s", PlayerName(i));
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
}
return 1;

Akcent_Voltaj
06/10/2012, 08:57 AM
i dont want this..it isnt what i asked..i asked to fix my cmd cause it doesent work properly.i type /mask and it says i took it off and i type again and same i want to type /mask to take off/and put it on.

Danyal
06/10/2012, 09:31 AM
try this...

if (strcmp(cmd, "/mask", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
if(PlayerInfo[playerid][pMaskuse] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, " Ti-ai pus masca!");
GetPlayerName(playerid, sendername, sizeof(sendername));
}
}
else if(PlayerInfo[playerid][pMaskuse] == 1)
{
ShowPlayerNameTagForPlayer(i,playerid, 1);
PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
GetPlayerName(playerid, sendername, sizeof(sendername));
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu esti Hitman !");
}
return 1;
}

Akcent_Voltaj
06/10/2012, 01:04 PM
fixed :D