Getplayerpos
#1

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
Reply
#2

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

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
Reply
#4

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)