My server crashes.. - 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: My server crashes.. (
/showthread.php?tid=418813)
My server crashes.. -
Mikkel_RE - 26.02.2013
Hey, when i use /mask the server just stops responding, but i still see it running, i just cant connect.. can you please help me finding out whats wrong with this command?
Код:
if(strcmp(cmd,"/mask",true) == 0)
{
if(PlayerInfo[playerid][pLevel] >= 5)
{
if(PlayerInfo[playerid][pMask] == 1)
{
if(MaskOn[playerid] == 0)
{
new string[256];
MaskOn[playerid] = 1;
new rand = 1000 + random(8999);
MaskNumber[playerid] = rand;
format(string, sizeof(string), "* %s takes out a mask and places it over their head. *", MaskOnOff(playerid));
ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
format(string, sizeof(string), "Stranger_%d", MaskNumber[playerid]);
masklabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 30.0, 40.0, 50.0, 8.0, 0);
Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0,0.0,0.2);
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
}
else return SendClientMessage(playerid, COLOR_WHITE, "You already have your mask on.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a Mask.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "You must be level 5 and above to use a mask.");
return 1;
}
Re: My server crashes.. -
Blaeks - 26.02.2013
it happens to you when you call the command array field that does not exist, try this command
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0) // by Blaeks
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMask] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, " you dont have mask");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GRAD1, " you arent 5 lvl.");
return 1;
}
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
PlayerInfo[playerid][pMaskuse] = 1;
SendClientMessage(playerid, COLOR_WHITE, " you put mask on head.");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s stavlja masku na sebe.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, PURPLE1,PURPLE2,PURPLE3,PURPLE4,PURPLE5);
}
return 1;
}
just edit that command how ever you want...