Issue onplayerstatechange
#1

Hello guys, so i am making a little fun Valet job. So i use OnPlayerStateChange callback in order to check whether the Valet is in a Valet car, while he is actually inside the car. So my issue comes in with the check to see if it is a Valet car. The issue is that 95% of the time, it works flawlessly i get a textdraw and everything to park the car. Sometimes it doesn't do anything when i get into the car, so i have to get out and get back into it, in order for it to work. Sometimes a couple of times... The reason i did not use OnPlayerEnterVehicle is because, with that the textdraws would come up before the player got into the car and if somebody was trying to steal their car, same thing would happen even if they were not really inside the car... So my script:

Код:
	    if(newstate == PLAYER_STATE_DRIVER)
		{
		 	if(IsPlayerInVehicle(playerid, ValetCar))
			{
				ValetInCar[playerid] = 1;
				SetPVarInt(playerid, "darbe", 1);
		  		new ValetRand = random(sizeof(MisLocations));
				new Float:x, Float:y, Float:z;
				x = ValetSpots[ValetRand][SpotX];
				y = ValetSpots[ValetRand][SpotY];
				z = ValetSpots[ValetRand][SpotZ];
				ValetPickupPark[playerid] = CreateDynamicPickup(1318, 14, x, y, z, -1, -1, playerid, 50.0);
		    	        ValetTime[playerid] = 15;
			        ValetTimer[playerid] = SetTimerEx("ValetTimeris", 1000, true, "i", playerid);
				TextDrawSetString(PastininkoInfo[playerid], "     Patarnautojo Darbas");
				TextDrawShowForPlayer(playerid, PastininkoInfo[playerid]);
				new string[250];
				format(string, sizeof(string), "~w~Pastatykite automobili aiksteleje~n~Laikas:~r~%s~n~~n~~w~Baigti darba:~r~ /baigtidarba", TimeConvert(ValetTime[playerid]));
				TextDrawSetString(PastininkoInfo2[playerid], string);
				TextDrawShowForPlayer(playerid, PastininkoInfo2[playerid]);
			}
		}
And it eithers works or it does not. I cannot find out, why it would not work sometimes.. The finding out of the player state i tested, worked fine. Anyone knows how to fix this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)