13.09.2012, 15:34
When Player died it spawn a tombstone and if somebody pickup the tombstone it disconnect player who is currently online, and the server restarts. What could be the problem?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pickupid == tombstonePickups[i] && i != playerid)
{
new tombstring[MAX_PLAYER_NAME+20];
GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
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;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(tombstonePickups[playerid] != -1)
{
DestroyPickup(tombstonePickups[playerid]);
}
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
#if defined USE_OBJECT
new Float:pA;
GetPlayerFacingAngle(playerid, pA);
tombstonePickups[playerid] = CreatePickup(2896,23,pX,pY,pZ+0.3,GetPlayerVirtualWorld(playerid));
#else
tombstonePickups[playerid] = CreatePickup(2896,23,pX,pY,pZ,GetPlayerVirtualWorld(playerid));
#endif
return 1;
}