onplayerentervehicle
#1

My codei've inserted my own enum)
pawn Код:
new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(GetVehicleModel(vehicleid) == 425 && pInfo[playerid][Scores] < 5000)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You need 5000 score to drive the Hunter!"); SetPlayerPos(playerid, X, Y, Z);
    }
Now I've experimented if it works. I've set my score to 5000, and 10000. None of them worked. How do I?
Reply
#2

Why not use GetPlayerScore instead of pInfo[playerid][Scores]?
Reply
#3

ok. lemme try that.
________________
thanks. it worked.
Reply
#4

You should remove all traces of the 'Scores' variable/enum, as it's useless when you have GetPlayerScore.
Reply
#5

Use it under OnplayerUpdate()
Код:
      
public OnPlayerUpdate(playerid)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    new vid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vid) == 425 && GetPlayerScore(playerid) < 5000)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You need 5000 score to drive the Hunter!"); 
        SetPlayerPos(playerid, X, Y, Z+1);
    }
   return 1;
}
Reply
#6

That is NOT something you would put under OnPlayerUpdate. You only need to check it when they get in a hunter, not ~30 times a second. That's ridiculous.
Reply
#7

I agree with MP2, why would you check it under OnPlayerUpdate, when OnPlayerEnterVehicle is available? Instead of making the server constantly check if he's in that vehicle, and if his score is more than 5000, he can just check the moment he enters the vehicle.

My guess is that when you set someones score, you use "SetPlayerScore" without setting the pInfo[playerid][Scores]. I'd do like MP2 said. Use SetPlayerScore and GetPlayerScore.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)