If player "z" pos is lower than...
#1

I'm working on this gamemode where i spawned some objects up in sky (Z: 1000+) and a rooftop.
And goal is to push the other "MONSTER" vehicles off. But i want it so that if the player falls off the they are out and have to watch the game using "SetPlayerCameraPos".
Well i thought i got it done but everytime i spawn it automatically says that im out even tho im now below 800 (Z pos). Could someone look at it and see if i did something wrong?

Код:
/* At top */
#define ORANGE 0xF97804FF

new DeadFallen[MAX_PLAYERS];
new IsSpawned[MAX_PLAYERS];

/* Then i set a timer to check this part every 1 second */
	new Float: x;
	new Float: y;
	new Float: z;
     new name[MAX_PLAYER_NAME];
     new string[128];
	
     GetPlayerName(playerid, name, sizeof(name));
	GetPlayerPos(playerid, x, y, z);
	
	if(z < 800 && DeadFallen[playerid] == 0 && IsSpawned[playerid] == 1) {
	DeadFallen[playerid] = 1; //So that if they happen to die they won't go back into the race
     SendClientMessage(playerid, ORANGE, "You have fallen off! Now watching the game!");
     format(string, sizeof(string), "[PLAYERNEWS] %s has fallen off the roof!");
     SendClientMessageToAll(playerid, YELLOW, string);
	TogglePlayerControllable(playerid, 0);
	SetPlayerCameraPos(playerid, 1743.9023,-1527.0787,1065.7150); //The roof is about 1020(z)-ish
	SetPlayerCameraLookAt(playerid, 1775.5223,-1514.3420,1038.7025);
	}
So please, any help is appreciated. Thanks !

Reply
#2

Well are you spawning them below 800? When does this timer get called? It should get called when they spawn. And maybe set it off after a delay of a few seconds to check for lag. Show the code where you set the timer.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)