Mask CMD error - 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 CMD error (
/showthread.php?tid=405129)
Mask CMD error -
Joshman543 - 05.01.2013
When I compile the script I receive and error saying:
Код:
cmd_mask should return a value
Here is the code:
PHP код:
CMD:mask(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playerid, COLOR_GREY, "You need to buy a mask from a 24/7!.");
if(PlayerInfo[playerid][pMasked] == 0)
{
PlayerInfo[playerid][pMasked] = 1;
SetPlayerAttachedObject(playerid, 9, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
SendClientMessage(playerid, COLOR_WHITE, "You have put on a mask! (/mask to romove it)");
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
}
}
else
{
PlayerInfo[playerid][pMasked] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have removed your mask!"); // This is message what was send when you remove your mask
if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
{
RemovePlayerAttachedObject(playerid, 9);
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
}
}
return 1;
}
}
}
Re: Mask CMD error -
arakuta - 05.01.2013
You must use a return true to finish the CMD!
pawn Код:
CMD:mask(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playerid, COLOR_GREY, "You need to buy a mask from a 24/7!.");
if(PlayerInfo[playerid][pMasked] == 0)
{
PlayerInfo[playerid][pMasked] = 1;
SetPlayerAttachedObject(playerid, 9, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
SendClientMessage(playerid, COLOR_WHITE, "You have put on a mask! (/mask to romove it)");
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
}
}
else
{
PlayerInfo[playerid][pMasked] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have removed your mask!"); // This is message what was send when you remove your mask
if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
{
RemovePlayerAttachedObject(playerid, 9);
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
}
}
return 1;
}
}
return 1;
}
Re: Mask CMD error -
[HK]Ryder[AN] - 05.01.2013
do it like this
pawn Код:
CMD:mask(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playerid, COLOR_GREY, "You need to buy a mask from a 24/7!.");
if(PlayerInfo[playerid][pMasked] == 0)
{
PlayerInfo[playerid][pMasked] = 1;
SetPlayerAttachedObject(playerid, 9, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
SendClientMessage(playerid, COLOR_WHITE, "You have put on a mask! (/mask to romove it)");
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
}
}
else
{
PlayerInfo[playerid][pMasked] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have removed your mask!"); // This is message what was send when you remove your mask
if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
{
RemovePlayerAttachedObject(playerid, 9);
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
}
}
return 1;
}
}
return 1;
}
EDIT: @Guy Above Me - Y U NO LET ME ANSWER FIRST lol