SA-MP Forums Archive
Help Something Not working right - 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)
+--- Thread: Help Something Not working right (/showthread.php?tid=392808)



Help Something Not working right - Buzzbomb - 15.11.2012

I created 4 separate Teams I created them Teams with Private vehicles.. Only that Certain Team Can Have access To Them.. Vehicles.. So I Done the code as I supposed it would work Well It Did At First.. For the First Team.. Then When i added the Others it all Messed up The first team Has Control of all the teams Vehicles And I just Noticed when i was trying to fix them i tried jump into a Public Vehicle It Kicked me out of the vehicle Telling me Im not part Of the First Team.. So Ill show you My Codes Hopefully it helps .. Other then that Im screwed I even tried OnPlayerEnterVehicle Ha It made everything alot worse Im confused .. I thought i did it all Right.. Obviously Not..

New Variable i guess that's How you Spell It
pawn Код:
new FiremanVehicle[12];
OnGameModeInit
pawn Код:
FiremanVehicle[1] = AddStaticVehicleEx(596,869.7223,-2384.4746,12.8661,22.3586,3, 3, -1); // LSFD Cheif Car
    FiremanVehicle[2] = AddStaticVehicleEx(490,872.8439,-2383.2832,12.8672,25.0720,3, 3, -1); // LSFD SUVtruck
    FiremanVehicle[3] = AddStaticVehicleEx(407,833.9660,-2397.6414,13.3359,297.7759,-1,-1, -1); // lsfd Firetruck 1
    FiremanVehicle[4] = AddStaticVehicleEx(407,830.2823,-2386.3196,13.3339,295.2881,-1,-1, -1); // lsfd Firetruck 2
    FiremanVehicle[5] = AddStaticVehicleEx(407,827.9481,-2381.1416,13.3366,296.5882,-1,-1, -1); // lsfd Firetruck 3
    FiremanVehicle[6] = AddStaticVehicleEx(407,826.7319,-2376.0515,13.3359,296.0691,-1,-1, -1); // lsfd Firetruck 4
    FiremanVehicle[7] = AddStaticVehicleEx(407,838.5652,-2404.7583,13.3353,296.8924,-1,-1, -1); // lsfd Firetruck 5
    FiremanVehicle[8] = AddStaticVehicleEx(563,901.0341,-2409.2175,13.0966,103.6467,1, 3, -1); // LSFD heli 1
    FiremanVehicle[9] = AddStaticVehicleEx(563,856.3829,-2457.7234,28.9835,354.1856,1, 3, -1); // LSFD heli 2
    FiremanVehicle[10] = AddStaticVehicleEx(563,842.2261,-2445.0054,28.9835,329.4261,1, 3, -1); // LSFD heli 3
    FiremanVehicle[11] = AddStaticVehicleEx(563,837.8069,-2416.5823,34.9835,300.6761,1, 3, -1); // LSFD heli 4
New Stock To Count My Created Private FireDepartment Vehicles
pawn Код:
stock CountFireTrucks()
{
    new count;
    for(new FV=0; FV != 12; FV++)
    {
        if(FiremanVehicle[FV] != INVALID_VEHICLE_ID)
        SetVehicleNumberPlate(FiremanVehicle[FV], "LSFD");
        SetVehicleToRespawn(FiremanVehicle[FV]);
        count ++;
    }
    return count;
}
OnPlayerStateChange
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        new count;
        new Vehicle = GetPlayerVehicleID(playerid);
        for(new FV=0; FV != 12; FV++)
        {
            if( Vehicle == FiremanVehicle[FV])
            {
                if(PlayerInfo[playerid][pFireTeam] == 2)
                {
                     SendClientMessage(playerid, 0x33AA33AA, "You're Not A Fireman!");
                     RemovePlayerFromVehicle(playerid);
                }
                else
                {
                     format(string1, sizeof(string1), "You Entered A %s, Owned By LSFD", VehicleNames[GetVehicleModel(Vehicle) -400]);
                     SendClientMessage(playerid, LIGHTRED, string1);
                }
            }
            count ++;
        }
        return count;
    }
Please Help Me The Only I cant Seem to Get Right.. Hehe the Other teams are Similar to all that codes But Named Different and Different Vehicles ETC....


Re: Help Something Not working right - Buzzbomb - 17.11.2012

BUMP!!!


Re: Help Something Not working right - Ballu Miaa - 17.11.2012

I really think the problem is there in your OnPlayerStateChange() callback!

Tell me one thing! which team is LVFD? PlayerInfo[playerid][pFireTeam] = 2?


Re: Help Something Not working right - Buzzbomb - 19.11.2012

LVFD?? Im calling on the fireteam lvfd lsfd sffd will all be ... 2 So the vehicles be only access by FireTeam = 2

The License Plate And Owners tag will change Ill FIx it later... To give each team Own Names


Re: Help Something Not working right - Ballu Miaa - 19.11.2012

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        new count;
        new Vehicle = GetPlayerVehicleID(playerid);
        for(new FV=0; FV != 12; FV++)
        {
            if( Vehicle == FiremanVehicle[FV])
            {
                if(PlayerInfo[playerid][pFireTeam] != 2)
                {
                     SendClientMessage(playerid, 0x33AA33AA, "You're Not A Fireman!");
                     RemovePlayerFromVehicle(playerid);
                }
                else
                {
                     format(string1, sizeof(string1), "You Entered A %s, Owned By LSFD", VehicleNames[GetVehicleModel(Vehicle) -400]);
                     SendClientMessage(playerid, LIGHTRED, string1);
                }
            }
            count ++;
        }
        return count;
    }



Re: Help Something Not working right - Buzzbomb - 20.11.2012

Well That works But I go and Do my cop cars Nope I just get right in them

About the same as my code did...


Re: Help Something Not working right - Buzzbomb - 21.11.2012

bumppppppp Come ON!


Re: Help Something Not working right - James Coral - 21.11.2012

errors?


Re: Help Something Not working right - Henkie - 21.11.2012

Quote:
Originally Posted by Buzzbomb
Посмотреть сообщение
Well That works But I go and Do my cop cars Nope I just get right in them

About the same as my code did...
If you show us the code for the police vehicles, we can help you


AW: Help Something Not working right - Skimmer - 21.11.2012

I don't know why you return counter below OnPlayerStateChange?
pawn Код:
return count; // This code
Do you know? You can use also the value 0 in variable.
pawn Код:
new FiremanVehicle[11];
pawn Код:
FiremanVehicle[0] = AddStaticVehicleEx(596,869.7223,-2384.4746,12.8661,22.3586,3, 3, -1); // LSFD Cheif Car
FiremanVehicle[1] = AddStaticVehicleEx(490,872.8439,-2383.2832,12.8672,25.0720,3, 3, -1); // LSFD SUVtruck
FiremanVehicle[2] = AddStaticVehicleEx(407,833.9660,-2397.6414,13.3359,297.7759,-1,-1, -1); // lsfd Firetruck 1
FiremanVehicle[3] = AddStaticVehicleEx(407,830.2823,-2386.3196,13.3339,295.2881,-1,-1, -1); // lsfd Firetruck 2
FiremanVehicle[4] = AddStaticVehicleEx(407,827.9481,-2381.1416,13.3366,296.5882,-1,-1, -1); // lsfd Firetruck 3
FiremanVehicle[5] = AddStaticVehicleEx(407,826.7319,-2376.0515,13.3359,296.0691,-1,-1, -1); // lsfd Firetruck 4
FiremanVehicle[6] = AddStaticVehicleEx(407,838.5652,-2404.7583,13.3353,296.8924,-1,-1, -1); // lsfd Firetruck 5
FiremanVehicle[7] = AddStaticVehicleEx(563,901.0341,-2409.2175,13.0966,103.6467,1, 3, -1); // LSFD heli 1
FiremanVehicle[8] = AddStaticVehicleEx(563,856.3829,-2457.7234,28.9835,354.1856,1, 3, -1); // LSFD heli 2
FiremanVehicle[9] = AddStaticVehicleEx(563,842.2261,-2445.0054,28.9835,329.4261,1, 3, -1); // LSFD heli 3
FiremanVehicle[10] = AddStaticVehicleEx(563,837.8069,-2416.5823,34.9835,300.6761,1, 3, -1); // LSFD heli 4