Solved. - 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: Solved. (
/showthread.php?tid=111300)
Solved. -
Ace_Menace - 30.11.2009
Basically, I want this.
When you die, the Exact positon (x,y,z) is recorded.
When you spawn you spawn in this position.
Possible?
Re: [Help?] How Can I Retrieve A Player's Spawn At Their Death? -
bigcomfycouch - 01.12.2009
pawn Код:
new Float:SpawnX[MAX_PLAYERS];
new Float:SpawnY[MAX_PLAYERS];
new Float:SpawnZ[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SpawnX[MAX_PLAYERS] = 0.0;
SpawnY[MAX_PLAYERS] = 0.0;
SpawnZ[MAX_PLAYERS] = 0.0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, SpawnX[playerid], SpawnY[playerid], SpawnZ[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(SpawnX[playerid] != 0.0 && SpawnY[playerid] != 0.0 && SpawnZ[playerid] != 0.0)
SetPlayerPos(playerid, SpawnX[playerid], SpawnY[playerid], SpawnZ[playerid]);
return 1;
}
Re: [Help?] How Can I Retrieve A Player's Spawn At Their Death? -
Ace_Menace - 01.12.2009
Thanks for the Reply, it indeed has helped me.
1 Problem with what you recommended.
pawn Код:
error 032: array index out of bounds (variable "SpawnX")
error 032: array index out of bounds (variable "SpawnY")
error 032: array index out of bounds (variable "SpawnZ")
Re: [Help?] array index out of bounds | Error Code: 032 | -
bigcomfycouch - 01.12.2009
Код:
public OnPlayerConnect(playerid)
{
SpawnX[playerid] = 0.0;
SpawnY[playerid] = 0.0;
SpawnZ[playerid] = 0.0;
}
Forgot to change max_players to playerid
Solved! -
Ace_Menace - 01.12.2009
Solved! Compiled and everything.
I will let you know how it works out.