SA-MP Forums Archive
What's wrong here? - 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: What's wrong here? (/showthread.php?tid=268973)



What's wrong here? - Cjgogo - 14.07.2011

I made this code,put it in OnPlayerUpdate nut anyway half of the code isn't working:

pawn Код:
if(model == 541 && gTimeTravel[playerid] == 1 && GetPlayerSpeed(playerid) == 154)
   {
     SetPlayerPos(playerid,953.7294,-5127.9546,10.8525);
     if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(vehicleid,953.7294,-5127.9546,10.8525) && SetVehicleHealth(vehicleid,0);
     SetPlayerWeather(playerid,16);
     new Float:x,Float:y,Float:z;
     SetPlayerPos(playerid,x,y,z+3);
     SendClientMessage(playerid,COLOR_RED,"2012.Aquring infos......");
     SendClientMessage(playerid,COLOR_RED,"System damage:99%,car destroyed,sending survival infos....");
     SendClientMessage(playerid,COLOR_RED,"System:Car detected on island,around.........");
     SendClientMessage(playerid,COLOR_RED,"SYSTEM STATE:CRITICAL,DAMAGE 100%,shutting down....");
     gTimeTravel[playerid] = 0;
  }
So the client messages can't be sent why?


Re: What's wrong here? - Cjgogo - 14.07.2011

any1?


Re: What's wrong here? - Toreno - 14.07.2011

Nothing happens when you do the code or whatever it is?


Re: What's wrong here? - HP - 14.07.2011

Assuming that the GetPlayerSpeed is taking the speed of the vehicle - are you sure that you want to check if the speed is precisely 154, because the speed might get bigger, depending on the vehicle of course.

Also, you shouldn't use that OnPlayerUpdate. I suggest you to use timers, y_timers would be even better.


Re: What's wrong here? - Scenario - 14.07.2011

Let me add on to what "HP" said:

When sending messages under "OnPlayerUpdate," they will be sent at least 3 times per second if the functions are performed- ultimately spamming the user in which the messages are being sent to. I doubt you want that happening.


Re: What's wrong here? - HP - 14.07.2011

You could simply fool that by adding a variable and checking before sending the messages, but well yes - we don't want to get that messy, do we.