SA-MP Forums Archive
Check if player is on the ground>? - 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: Check if player is on the ground>? (/showthread.php?tid=70539)



Check if player is on the ground>? - hipy - 25.03.2009

hi i want to make a sumo server only how can check if sombody if off the ring( hits the ground ) instead of in the air on the object?

And another question, if a player dies how can i make his vehicle go away( same goes for spawn how can i give him a car :P )

ty !!!


Re: Check if player is on the ground>? - LarzI - 25.03.2009

1. use a timer and IsPlayerInCube (search for it).


2. put this on top of script
pawn Код:
new playerVeh[MAX_PLAYERS]; = -1
then do in OnPlayerStateChange:

pawn Код:
//spawning
if(newstate == PLAYER_STATE_SPAWNED)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    playerVeh[playerid] = CreateVehicle(model, x+2, y, z+0.5, 0, -1, -1, -1); //Change model
}

Then do
pawn Код:
public OnPlayerDeath(playerid, killerid, reason);
{
    if(playerVeh[playerid] > -1)
        DestroyVehicle(playerVeh[playerid]);
    return true;
}



Re: Check if player is on the ground>? - hipy - 25.03.2009

Код:
new playerVeh[MAX_PLAYERS]; = -1
returns:
J:\Documents and Settings\Administrator\Bureaublad\sumo.pwn(3) : error 010: invalid function or declaration
J


Re: Check if player is on the ground>? - Mentis - 25.03.2009

(removed)


Re: Check if player is on the ground>? - LarzI - 25.03.2009

I forgot that it didn't return any ids, sorry
If you'd use AddStaticVehicle, you couldn't have 0 as default value, since 0 is a ID


Re: Check if player is on the ground>? - Pyrokid - 25.03.2009

Quote:
Originally Posted by hipy
Код:
new playerVeh[MAX_PLAYERS]; = -1
returns:
J:\Documents and Settings\Administrator\Bureaublad\sumo.pwn(3) : error 010: invalid function or declaration
J
Because it's supposed to be:
pawn Код:
new playerVeh[MAX_PLAYERS] = -1;



Re: Check if player is on the ground>? - LarzI - 27.03.2009

Omg... Why didn't I see that one :P
It was just a little typ0, so it should work the way I gave it to you.
If you're just using new playerVeh[MAX_PLAYERS]; you MUST change if(playerVeh[playerid] > -1) to if(playerVeh[playerid] > 0)