SA-MP Forums Archive
Problem with gTeam-Cars - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with gTeam-Cars (/showthread.php?tid=188013)



Problem with gTeam-Cars - mel~vin - 05.11.2010

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


Re: Problem with gTeam-Cars - blackwave - 06.11.2010

Код:
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


Re: Problem with gTeam-Cars - mel~vin - 06.11.2010

Mhh,... it dosn't work


Re: Problem with gTeam-Cars - Moglizorz. - 06.11.2010

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


Re: Problem with gTeam-Cars - mel~vin - 06.11.2010

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


Re: Problem with gTeam-Cars - Tee - 06.11.2010

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.


Re: Problem with gTeam-Cars - mel~vin - 06.11.2010


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"



Re: Problem with gTeam-Cars - Tee - 06.11.2010

Yeah thats what i said.

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



Re: Problem with gTeam-Cars - mel~vin - 06.11.2010

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