car getting mixed up with faction car
#1

ok so i made 2 cars that check for drivers name ,if the drivers name is NOT the one i put in the script,he gets ejected ,therefore its a personal car .

ill show here the entire code so people can help me out

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[256];
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) MyOldCar[playerid] = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
    if(newcar == NAMEOFCARxD)
    {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        if(strcmp(PlayerName, "Player_nameblablabla", true) == 0)
        {
            SendClientMessage(playerid, COLOR_1BLUE,"* Welcome to your car.");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_RED," This vehicle is not for you.");
        }
    }
the problem is , 1 of 2 cars works,but the other says im not in the Hitman faction ,i remember i had this problem when i tried to put my private cars into a filterscript cause they got mixed up with GM's cars ,but this time its in the GM and i dont know why they get mixed up
Reply
#2

You should be doing this in
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}
and you have only specified one car in that code.
Reply
#3

yea cause the 2nd one is just copy paste ,changing the name of the car and voila
Reply


Forum Jump:


Users browsing this thread: