How create gangs.
#7

Here's it as a blank game mode, all compiles (for me)

I have not given them specific spawn points, but the skins are right.

pawn Code:
#include <a_samp>
new playerGang[MAX_PLAYERS];

#define GANG_NONE       0
#define GANG_GROVE      1
#define GANG_BALLA      2
#define GANG_VAGOS      3
#define GANG_AZTECAS    4


new gangGroveSkins[] = {105,106,107};
new gangBallaSkins[] = {102,103,104};
new gangSantosVagosSkins[] = {108,109,110};
new gangLosAztecas[] = {114,115,116};


giveGangSkinAndWeapons(playerid) {
    GivePlayerWeapon(playerid,  5, 1); //Baseball bat
    GivePlayerWeapon(playerid, 24, 20); //Desert Eagle, 20x Ammo
    GivePlayerWeapon(playerid, 25, 12); //Shot Gun, 12x Ammo
    switch (playerGang[playerid]) {
        case GANG_GROVE: {
            SetPlayerSkin(playerid, gangGroveSkins[random(sizeof(gangGroveSkins))]);
        }
        case GANG_BALLA: {
            SetPlayerSkin(playerid, gangBallaSkins[random(sizeof(gangBallaSkins))]);
        }
        case GANG_VAGOS: {
            SetPlayerSkin(playerid, gangSantosVagosSkins[random(sizeof(gangSantosVagosSkins))]);
        }
        case GANG_AZTECAS: {
            SetPlayerSkin(playerid, gangLosAztecas[random(sizeof(gangLosAztecas))]);
        }
        default: {
            SetPlayerSkin(playerid, 0);
        }
    }
}

main() {
    print("----------------------------------");
    print("Basic Gang System");
    print("----------------------------------");
}

public OnGameModeInit() {
    SetGameModeText("Gang Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}
public OnGameModeExit() {
    return 1;
}
public OnPlayerRequestClass(playerid, classid) {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}
public OnPlayerConnect(playerid) {
    return 1;
}
public OnPlayerDisconnect(playerid, reason) {
    playerGang[playerid]=0;
}
public OnPlayerSpawn(playerid) {
    giveGangSkinAndWeapons(playerid);
    switch (playerGang[playerid]) {
        case GANG_GROVE: {
            SetPlayerPos(playerid,0.0,0.0,3.0);
        }
        case GANG_BALLA: {
            SetPlayerPos(playerid,0.0,0.0,3.0);
        }
        case GANG_VAGOS: {
            SetPlayerPos(playerid,0.0,0.0,3.0);
        }
        case GANG_AZTECAS: {
            SetPlayerPos(playerid,0.0,0.0,3.0);
        }
        default: {
            SetPlayerPos(playerid,0.0,0.0,3.0);
        }
    }
}
public OnPlayerCommandText(playerid, cmdtext[]) {
    if(!strcmp(cmdtext, "/joingrove", true)) {
        SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to grove!");
        playerGang[playerid] = GANG_GROVE;
        giveGangSkinAndWeapons(playerid);
        return 1;
    }
    if(!strcmp(cmdtext, "/joinballa", true)) {
        SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to balla!");
        playerGang[playerid] = GANG_BALLA;
        giveGangSkinAndWeapons(playerid);
        return 1;
    }
    if(!strcmp(cmdtext, "/joinvagos", true)) {
        SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to vagos!");
        playerGang[playerid] = GANG_GROVE;
        giveGangSkinAndWeapons(playerid);
        return 1;
    }
    if(!strcmp(cmdtext, "/joinaztecas", true)) {
        SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to aztecas!");
        playerGang[playerid] = GANG_BALLA;
        giveGangSkinAndWeapons(playerid);
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
How create gangs. - by Gangster-rocks - 08.06.2012, 06:55
Re: How create gangs. - by Grimrandomer - 08.06.2012, 07:19
Re: How create gangs. - by Gangster-rocks - 08.06.2012, 09:46
Re: How create gangs. - by Gangster-rocks - 08.06.2012, 09:57
Re: How create gangs. - by Niko_boy - 08.06.2012, 10:08
Re: How create gangs. - by Gangster-rocks - 08.06.2012, 10:15
Re: How create gangs. - by Grimrandomer - 08.06.2012, 12:34

Forum Jump:


Users browsing this thread: 3 Guest(s)