08.06.2012, 07:19
Depends on how complex you wont this, if your after a gang spawn with gang weapons etc, you will need a way of:
Saving a players current gang e.g.
Some gang functions:
And when they type the gang command:
When they disconnect:
When they spawn:
This is just a very simple idea/template
Saving a players current gang e.g.
pawn Code:
new playerGang[MAX_PLAYERS];
pawn Code:
giveGangSkinAndWeapons(playerid) {
switch (playerGang[playerid]) {
case 1: {
//Set player to grove skin.
//Give grove weapons
}
case 2: {
//Set player to another gang skin.
//Give other gang's weapons
}
default: {
//Default stuff here.
}
}
}
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "/joingrove", true)) {
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to grove!");
playerGang[playerid] = 1;
giveGangSkinAndWeapons(playerid);
return 1;
}
if(!strcmp(cmdtext, "/joinother", true)) {
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to other!");
playerGang[playerid] = 2;
giveGangSkinAndWeapons(playerid);
return 1;
}
return 0;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason) {
playerGang[playerid]=0;
}
When they spawn:
pawn Code:
public OnPlayerSpawn(playerid) {
giveGangSkinAndWeapons(playerid);
switch (playerGang[playerid]) {
case 1: {
//set them to a spawn position for the gang.
}
case 2: {
//set them to a spawn position for the gang.
}
default: {
//Default stuff here i.e. they aint in any gang yet.
}
}
}