SA-MP Forums Archive
Getplayerpos - 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: Getplayerpos (/showthread.php?tid=409531)



Getplayerpos - Riggster - 21.01.2013

Right I have been looking at this code
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    // Declare 3 float variables to store the X, Y and Z coordinates in
    new Float:x, Float:y, Float:z;
 
    // Use GetPlayerPos, passing the 3 float variables we just created
    GetPlayerPos(playerid, x, y, z);
 
    // Create a cash pickup at the player's position
    CreatePickup(1212, 4, x, y, z, GetPlayerVirtualWorld(playerid));
   return 1;
}
I was wondering how would I use this code but put use more than one, because if I did this -
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    // Declare 3 float variables to store the X, Y and Z coordinates in
    new Float:x, Float:y, Float:z;
 
    // Use GetPlayerPos, passing the 3 float variables we just created
    GetPlayerPos(playerid, x, y, z);
 
    // Create a cash pickup at the player's position
    CreatePickup(1212, 4, x, y, z, GetPlayerVirtualWorld(playerid));
   return 1;
}
public OnPlayerSpawn(playerid, killerid, reason)
{
    // Declare 3 float variables to store the X, Y and Z coordinates in
    new Float:x, Float:y, Float:z;
 
    // Use GetPlayerPos, passing the 3 float variables we just created
    GetPlayerPos(playerid, x, y, z);
 
    // Create a cash pickup at the player's position
    CreatePickup(1212, 4, x, y, z, GetPlayerVirtualWorld(playerid));
   return 1;
}
Would it not overlap with each other. Please leave any help below


Re: Getplayerpos - arakuta - 21.01.2013

I didn't understand what you've done man, neither your question '-'


Re: Getplayerpos - Riggster - 21.01.2013

Just wondering if I can use new Float, Float:y, Float:z; and GetPlayerPos(playerid, x, y, z); more than once in a script without a overlap


Re: Getplayerpos - MattSlater - 21.01.2013

It won't overlap since im pretty sure the players would die at different position's each time :P


Re: Getplayerpos - arakuta - 21.01.2013

Yup. Because it's a local variable, getting destroyed by the last callback bracket, after the return ^^

You can't do twice if it's a global variable, because it's never get destroyed.