help me with allowing vehicles with score
#1

hello i need little help,
allowing Vehicle is there anything that Ex:
if player have 500 score then he can use the vehicle and if 0-499 he cant is there?, if yes pls tell me how can i do it.
Reply
#2

Something like this, you have to edit it for your needs though.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new veh = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER)
	{
 		if((GetPlayerScore(playerid) < 500)
 		{
 		    if(veh == VEHICLEID)
 		    {
 		        RemovePlayerFromVehicle(playerid);
   			}
		}
	}
	return 1;
}
Reply
#3

tryed but not working :/
Reply
#4

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerScore(playerid) < 500)
                {
                RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Just a little changed.
Reply
#5

wizzy you dont understand what i exactly means,
i mean that if someone need to use hunter he need to get 500 scores like this..
Reply
#6

Example: if player score is less than 425, he wont be able to drive a Hunter(425).
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
     if(newstate == PLAYER_STATE_DRIVER)
     {
          if(!CanDriveVehicle(playerid))
          {
               RemovePlayerFromVehicle(playerid);
          }
     }
     return 1;
}

CanDriveVehicle(playerid) // If player score is higher than #vehicleid, he may drive the car, else - wont
    return (GetPlayerScore(playerid) > GetPlayerVehicleID(playerid));
Reply
#7

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
wizzy you dont understand what i exactly means,
i mean that if someone need to use hunter he need to get 500 scores like this..
You never said anything about specific vehicles.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 425:
            {
                if(GetPlayerScore(playerid) < 500)
                {
                    SendClientMessage(playerid, -1, "You need atleast 500 score to use that vehicle");
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
    return 1;
}
That's for hunter. For other vehicle's models, use it like that: case 425, N, N:
Reply
#8

thanks that work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)