Private car a problem
#1

Hello this is my code for private car.Problem is that everybody can drive my car. I want this car to be only for me.Where is my wrong ?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(vehicleid == FireCat)
     {
     new pName[MAX_PLAYER_NAME];
     GetPlayerName(playerid,pName,sizeof(pName));
     if(strcmp(pName,"Jayceon_Taylor") == 0)
     {
     SendClientMessage(playerid,-1,"This is your private car!");
     }
     else
     {
     RemovePlayerFromVehicle(playerid);
     SendClientMessage(playerid,-1,"This isnt your car!");
     }
     }
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(vehicleid == FireCat)
     {
        new pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid,pName,sizeof(pName));
        if(strcmp(pName,"Jayceon_Taylor") == 0)
        {
            SendClientMessage(playerid,-1,"This is your private car!");
        }
         else
        {
         RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,-1,"This isnt your car!");
        }
    }
    return 1;
}
try this
Reply
#3

So much errors
Reply
#4

List them.
Reply
#5

you can easily create that type of system with using variable
Reply
#6

Where's the

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
new pname[MAX_PLAYER_NAME];
?
Reply
#7

Everyone who has replied so far made no contributions. Just felt like pointing that out.

And I'm curious as to why no one reads the Wiki anymore.
Quote:
RemovePlayerFromVehicle();
This function will not work when used in OnPlayerEnterVehicle, because the player isn't in the vehicle when the callback is called. Use OnPlayerStateChange (newstate == 2/PLAYER_STATE_DRIVER) instead.

Reply
#8

Quote:
Originally Posted by Bakr
Посмотреть сообщение
Everyone who has replied so far made no contributions. Just felt like pointing that out.

And I'm curious as to why no one reads the Wiki anymore.
hmm you are right bakr i also forget about this thing . You need to paste this code under
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
otherwise you get errors .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)