Server Crashing - 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: Server Crashing (
/showthread.php?tid=377866)
Server Crashing -
kbalor - 15.09.2012
Everytime player pick this pickup, server always restarts and people always reconnecting. There is something wrong with the code below?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pickupid == tombstonePickups[i] && i != playerid)
{
new tombstring[128],tombname[MAX_PLAYER_NAME];
GetPlayerName(i,tombname,sizeof(tombname));
format(tombstring,sizeof(tombstring), "~g~+$400 ~n~~r~Coffin of:~n~~w~%s", tombname);
GameTextForPlayer(playerid,tombstring,3000,3);
DestroyPickup(tombstonePickups[i]); //Since you want to remove the coffin of the player that is dead, you'll have to place 'i' and not 'playerid'
tombstonePickups[i] = -1; // Same for here
GivePlayerMoney(playerid, 400);
break;
}
}
return 1;
}
Re: Server Crashing -
KoczkaHUN - 15.09.2012
Is tombstonePickups MAX_PLAYERS big? How do you create it?
pawn Код:
new tombstonePickups[MAX_PLAYERS];
?
Re: Server Crashing -
scottyishere - 15.09.2012
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(pickupid == tombstonePickups[i] && i != playerid)
{
new tombstring[128],tombname[MAX_PLAYER_NAME];
GetPlayerName(i,tombname,sizeof(tombname));
format(tombstring,sizeof(tombstring), "~g~+$400 ~n~~r~Coffin of:~n~~w~%s", tombname);
GameTextForPlayer(playerid,tombstring,3000,3);
DestroyPickup(tombstonePickups[i]); //Since you want to remove the coffin of the player that is dead, you'll have to place 'i' and not 'playerid'
tombstonePickups[i] = -1; // Same for here
GivePlayerMoney(playerid, 400);
break;
}
}
return 1;
}
Try this.
Re: Server Crashing -
kbalor - 15.09.2012
Quote:
Originally Posted by scottyishere
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; if(pickupid == tombstonePickups[i] && i != playerid) { new tombstring[128],tombname[MAX_PLAYER_NAME]; GetPlayerName(i,tombname,sizeof(tombname)); format(tombstring,sizeof(tombstring), "~g~+$400 ~n~~r~Coffin of:~n~~w~%s", tombname); GameTextForPlayer(playerid,tombstring,3000,3); DestroyPickup(tombstonePickups[i]); //Since you want to remove the coffin of the player that is dead, you'll have to place 'i' and not 'playerid' tombstonePickups[i] = -1; // Same for here GivePlayerMoney(playerid, 400); break; } } return 1; }
Try this.
|
Okay, man I should try this!
@KoczkaHUN - I have already that on top of my script
thanks!
+rep both