Problem with gTeam-Cars
#1

Ok i have a problem,when i have 2 fraktioncars in my script,the script works but if i have 3 fraktionscars it didn't works:

pawn Код:
Cars[LSPD]=LSPD1 = AddStaticVehicle(596,1535.7490,-1668.1628,13.1043,359.4030,0,1);
Cars[LSPD]=LSPD2 = AddStaticVehicle(596,1535.8396,-1677.4053,13.1056,180.1512,0,1);
Cars[LSPD]=LSPD3 = AddStaticVehicle(596,1601.7650,-1683.9963,5.6129,89.1848,0,1);

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[LSPD] )
        {
            if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, FARBE_ROT, "You have no keys!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
hope you can help
thanks
Reply
#2

Код:
Cars[LSPD1]= AddStaticVehicle(596,1535.7490,-1668.1628,13.1043,359.4030,0,1);
Cars[LSPD2]= AddStaticVehicle(596,1535.8396,-1677.4053,13.1056,180.1512,0,1);
Cars[LSPD3]= = AddStaticVehicle(596,1601.7650,-1683.9963,5.6129,89.1848,0,1);

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[LSPD] )
        {
            if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, FARBE_ROT, "You have no keys!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}

Try that, instead of put 2x "=" simbols, cuz I think it's not allowed on programming
Reply
#3

Mhh,... it dosn't work
Reply
#4

So what errors do you get on compile? By not working I assume this is what you mean.
Reply
#5

No,there are no errors but in game the funktion doesn't work
Reply
#6

There. It should work.

At the top of your script, put:
pawn Код:
new LSPD1,LSPD2,LSPD3;
I did it for each car.
pawn Код:
LSPD1 = AddStaticVehicle(596,1535.7490,-1668.1628,13.1043,359.4030,0,1);
LSPD2 = AddStaticVehicle(596,1535.8396,-1677.4053,13.1056,180.1512,0,1);
LSPD3 = AddStaticVehicle(596,1601.7650,-1683.9963,5.6129,89.1848,0,1);


public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
    new CarCheck = GetPlayerVehicleID(playerid);
    if(CarCheck == LSPD1 && gTeam[playerid] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, FARBE_ROT, "You have no keys!");
    }
    }
    if(newstate == 2)
    {
    new CarCheck = GetPlayerVehicleID(playerid);
    if(CarCheck == LSPD2 && gTeam[playerid] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, FARBE_ROT, "You have no keys!");
    }
    }
    if(newstate == 2)
    {
    new CarCheck = GetPlayerVehicleID(playerid);
    if(CarCheck == LSPD3 && gTeam[playerid] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, FARBE_ROT, "You have no keys!");
    }
    }
    return 1;
}
But the way u had it was that :
Cars[LSPD] would equal to LSPD1 and LSPD2 and LSPD3, and it did not make any sense.
Reply
#7


must i do for every car a new because?:
pawn Код:
C:\Users\Melvin\Desktop\Neuer Ordner\gamemodes\LoGTA.pwn(173) : error 017: undefined symbol "LSPD1"
C:\Users\Melvin\Desktop\Neuer Ordner\gamemodes\LoGTA.pwn(174) : error 017: undefined symbol "LSPD2"
C:\Users\Melvin\Desktop\Neuer Ordner\gamemodes\LoGTA.pwn(175) : error 017: undefined symbol "LSPD3"
C:\Users\Melvin\Desktop\Neuer Ordner\gamemodes\LoGTA.pwn(289) : error 017: undefined symbol "LSPD1"
Reply
#8

Yeah thats what i said.

At the top of your script, put:
pawn Код:
new LSPD1,LSPD2,LSPD3;
Reply
#9

it works very nice
i love you
:*
thanks,thanks,....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)