Need help - Priv car
#1

I got this Private Car system from another member in here. I get error when i compile it. Here is the script:
And yes, my name is NuckFuts, lol

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == NuckFuts)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(strcmp(pName,"NuckFuts") == 0)
{
SendClientMessage(playerid,-1,"Welcome to your car, Mang!");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"This car is payed and reserved for NuckFuts!");
}
}
Reply
#2

That will call the function immediatly when a player is in a radius of a vehicle and trying to enter it. (presses enter or F)
I recommend a usage of OnPlayerStateChange:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new pName[24]; GetPlayerName(playerid,pName,24);
        if( (!strcmp(pName,"NuckFuts")) && (GetPlayerVehicleID(playerid) == NuckFuts))
        {
             //....
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,-1,"This car is payed and reserved for NuckFuts!");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)