SA-MP Forums Archive
Respawn - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Respawn (/showthread.php?tid=66320)



Respawn - Nimphious - 21.02.2009

Ok,

Trying to do deathmatch's when they player dies they respawn there,

This is what I have so far,

pawn Код:
if(!strcmp(cmdtext, "/hell", true))
{
  new dname[MAX_PLAYER_NAME];
  new dstring[256];
  new helldm == 1; // The variable
  new rand = random(sizeof(BRandomSpawns));
  GetPlayerName(playerid, dname, sizeof(dname));
  format(dstring, sizeof(dstring), "%s Has Joined The DeathMatch(Ghost Town Of Hell)", dname);
  SendClientMessageToAll(0xFFFFAEFF, dstring);
  SetPlayerPos(playerid,BRandomSpawns[rand][0],BRandomSpawns[rand][1],BRandomSpawns[rand][2]);
  SetPlayerHealth(playerid, 100.00);
  SetPlayerArmour(playerid, 100.00);
  GivePlayerWeapon(playerid, 6, 500);
  GivePlayerWeapon(playerid, 26, 500);
  GivePlayerWeapon(playerid, 32, 500);
  GivePlayerWeapon(playerid, 41, 500);
  return 1;
}
@ onplayerconnect

pawn Код:
public OnPlayerConnect(playerid)
{
    helldm == 0;
    return 1;
}
@ onplayerdeath

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(helldm == 1)
    {
    SetPlayerPos(playerid,BRandomSpawns[rand][0],BRandomSpawns[rand][1],BRandomSpawns[rand][2]);
    }
    return 1;
}

I have no idea what I done wrong, any suggestions.

Also I no my
pawn Код:
new dstring[256];
the string is big but anyway.


Re: Respawn - Nimphious - 21.02.2009

Any solutions I just can't figure it out


Re: Respawn - ronyx69 - 21.02.2009

Remember ? You die (not respawn in the start) then you are on the ground for maybe 3 seconds. but the position sets before you respawn at your start. This function needs to be at OnPlayerSpawn, not OnPlayerDeath


Re: Respawn - Norn - 21.02.2009

Quote:
Originally Posted by ronyx69
Remember ? You die (not respawn in the start) then you are on the ground for maybe 3 seconds. but the position sets before you respawn at your start. This function needs to be at OnPlayerSpawn, not OnPlayerDeath
I fixed it for him via msn.


Re: Respawn - Nimphious - 21.02.2009

Quote:
Originally Posted by Norn
Quote:
Originally Posted by ronyx69
Remember ? You die (not respawn in the start) then you are on the ground for maybe 3 seconds. but the position sets before you respawn at your start. This function needs to be at OnPlayerSpawn, not OnPlayerDeath
I fixed it for him via msn.
Hehe thnx anyways :P