Teams and teams vehicles, need help.
#2

pawn Код:
#include <a_samp>

#define COLOR_RED 0xFF0000AA

enum Teams {
    tPolice,
    tEms
}

stock const TeamColors[Teams] = {
    0x1B4CE0AA,
    0xFF8AF5AA
};

new
    Teams: gTeam[MAX_PLAYERS char],
    Teams: gTeamVehicle[(MAX_VEHICLES + 1) char]
;

main() {
    print("\nBlank Gamemode by your name here\n");
}

public OnGameModeInit() {
    AddPlayerClass(282,2497.2693,-1676.9578,13.3398,23.6501,0,0,0,0,0,0); //POLICE
    AddPlayerClass(275,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //EMS

    SetVehicleToTeam(tPolice, AddStaticVehicle(598,-210.8453,999.8466,19.3565,88.9803,0,1)); // FCpolice1
    SetVehicleToTeam(tEms, AddStaticVehicle(416,-330.7315,1063.7899,19.8899,270.1239,1,3)); // FCems1
}

stock SetVehicleToTeam(Teams: teamid, vehicleid) {
    if(0 < vehicleid < sizeof gTeamVehicle) {
        gTeamVehicle{vehicleid} = teamid;
        return true;
    }
    return false;
}

public OnPlayerRequestClass(playerid, classid) {
    switch(classid) {
        case 0: gTeam{playerid} = tPolice;
        case 1: gTeam{playerid} = tEms;
    }
    return true;
}

public OnPlayerSpawn(playerid) {
    SetPlayerColor(playerid, TeamColors[gTeam{playerid}]);
    return true;
}

public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(newstate == PLAYER_STATE_DRIVER) {
        new
            vehicleid = GetPlayerVehicleID(playerid)
        ;
        if(gTeam{playerid} != gTeamVehicle{vehicleid}) {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_RED, "You don't belong to the correct faction.");
            return true;
        }
    }
    return true;
}
Reply


Messages In This Thread
Teams and teams vehicles, need help. - by needhack - 23.02.2013, 14:11
AW: Teams and teams vehicles, need help. - by Nero_3D - 23.02.2013, 14:43
Re: Teams and teams vehicles, need help. - by needhack - 23.02.2013, 14:47
AW: Teams and teams vehicles, need help. - by Nero_3D - 23.02.2013, 15:08
Re: Teams and teams vehicles, need help. - by needhack - 23.02.2013, 15:16
Re: Teams and teams vehicles, need help. - by needhack - 23.02.2013, 16:01

Forum Jump:


Users browsing this thread: 1 Guest(s)