with something small -
leon44 - 18.01.2015
Hello guys.
what happens is that I wanted to ask them for help,
Will see, I'm doing a mission of parkour and good this is exactly what I want in parkour.
I want that for example if the player falls of the parkour, I want that to half the ground respawn,
I mean that if it falls below the map of the parkour Respawn, Help me Please.
here are the coordinates where I want if the player reaches falling, to those coordinates respawn again:
AddPlayerClass(0,1173.1627,-2065.5620,432.3798,359.3109,0,0,0,0,0,0);
Thanks
Re: with something small -
Schneider - 18.01.2015
Use GetPlayerPos to get the players current position, see if the z-value is below the map, then use SetPlayerPos to spawn the player on your coordinates.
Re: with something small -
leon44 - 18.01.2015
thanks for replying Schneider, someone me said the same but I'm not very good at this, I could help with a code or some tutorial which teach this please, these are the coordinates of spawn Player:
Quote:
SetPlayerPos(playerid, -1622.7039,673.5800,-4.9063);
SetPlayerFacingAngle(playerid,150.9650);
|
Re: with something small -
Schneider - 18.01.2015
Alright, first of all, go ingame and go the the lowest point of your map and type /save
Open savedpositions.txt in your UserFiles folder and see what the z-coordinate is.
Now in your gamemode you'll have to start a timer with a for example 1 second interval, in the OnGameModeInit() callback:
pawn Код:
SetTimer("CheckHeight", 1000, 1);
Then at the bottom of your script, add the following function and edit with your own preferences:
pawn Код:
forward CheckHeight();
public CheckHeight()
{
new Float:Z;
for(new i; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerPos(i, Z, Z, Z);
if(Z < LOWEST_COORDINATE) // enter here the lowest z-coordinate
{
SetPlayerPos(i, -1622.7039,673.5800,-4.9063);
SetPlayerFacingAngle(i, 150.9650);
}
}
return 1;
}
Re: with something small -
leon44 - 18.01.2015
Friend, Thank you for taking your time helping me, but the code that you are giving me it has not me worked,
What is the error?
Re: with something small -
Schneider - 18.01.2015
I don't what IS the error?
Do you get an error when you compile, or doesn't it work ingame?
Re: with something small -
leon44 - 18.01.2015
Look, I put the that code are you giving me and gave me this error compiling:
Quote:
D:\Desktop\Archives\Gamemodes\Server\gamemodes\Par kour.pwn(677) : error 017: undefined symbol "LOWEST_COORDINATE"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
|
And to eliminate this error i did this:
and the error is eliminated, then i went to the game to try to see if it worked but it turns out it did not work :/
Re: with something small -
Schneider - 18.01.2015
:P
No, read the first part of my post and read what I wrote in that function:
// enter here the lowest z-coordinate"
You have to actually write down the lowest coordinate there.
Re: with something small -
leon44 - 18.01.2015
Just like me you said I did., but it did not work I look, here this the coordinates that I use:
Coordinates Spawn Player:
Quote:
SetPlayerPos(playerid,1173.1627,-2065.5620,432.379 ;
SetPlayerFacingAngle(playerid, 359.3109);
|
Coordinates of the fall of parkour:
Quote:
AddPlayerClass(104,1198.9684,-2022.5673,351.9539,74.8250,0,0,0,0,0,0);
|
Then I did the code in this way:
Quote:
forward CheckHeight();
public CheckHeight()
{
new Float:Z;
for(new i; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerPos(i, Z, Z, Z);
if(74.8250 < LOWEST_COORDINATE) // ''74.8250, Are the coordinates ''Z'' the falling of parkour
{
SetPlayerPos(i,1173.1627,-2065.5620,432.379 ;
SetPlayerFacingAngle(i, 359.3109);
}
}
return 1;
}
|
what's wrong? :/
Re: with something small -
Schneider - 18.01.2015