DerFamer ich zeige dir mal wie mein Fraktions-System aussieht vielleicht fällte es dir dann so etwas leicher:
Enum:
enum frakteEnum{
f_name[300],
Float:f_x,
Float:f_y,
Float:f_z,
Float:f_r,
f_inter,
f_world,
f_color
}
new fInfo[][frakteEnum] ={
{"Zivilist",329.0244,-1513.3033,36.0391,225.8344,0,0,weiß},//Zivilist 0
{"SAPD",213.4162,162.7460,1003.0234,274.4569,3,1,blau},//SAPD 1
{"SWAT",2731.5903,-2450.0164,17.5937,272.4424,0,0,helblau},//SWAT2
{"FBI",2286.9651,2431.6011,10.8203,176.4887,0,0,duneklhelblau},//FBI3
{"ARMY",214.2768,1822.5925,6.4141,265.0869,0,0,hellgrün},//ARMY4
{"Medic/Feuerwehr",302.9467,-1505.8025,24.6007,231.6743,0,0,rot},//MEDIC5
{"Fahrschule",2124.3032,-2273.0491,20.6719,221.7338,0,0,orange},//Fahrschule6
{"Aztecas",2788.4141,-1944.7075,13.5469,87.2128,0,0,türkis},//AZTECAS7
{"Vagos",204.6566,39.7421,2.5781,260.2514,0,0,gelb},//Vagos8
{"Ballas",1084.8976,-1226.7927,15.8203,269.7700,0,0,pink},//Ballas9
{"Yakuza",-2188.6282,-2265.0452,30.6250,71.4091,0,0,grau}//Yakuza10
};
/*
LSPD2
SWAT3
FBI 4
ARMY 5
Medic/Feuerwehr 6
Fahrschule 7
Aztecas 8
Vagos 9
Ballas 10
Yakuza 11
*/
isPlayerInFrakt(playerid,f_id){
if(sInfo[playerid][fraktion]==f_id)return 1;
return 0;
}
Public:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
if(!isPlayerInFrakt(playerid,0))
{
if(sInfo[playerid][spawnchange]==1)
{
new fID;
fID= sInfo[playerid][fraktion];
SetPlayerPos(playerid,fInfo[fID][f_x],fInfo[fID][f_y],fInfo[fID][f_z]);
SetPlayerFacingAngle(playerid,fInfo[fID][f_r]);
SetPlayerInterior(playerid,fInfo[fID][f_inter]);
SetPlayerVirtualWorld(playerid,fInfo[fID][f_world]);
SetPlayerColor(playerid,fInfo[fID][f_color]);
}
}
SendClientMessage(playerid,rot,"/hilfe um die Befehle zu sehen!");
return 1;
}
Befehle die nur als Fraktionsmitglied funktionieren:
ocmd:fraktionshilfe(playerid,params[])
{
if(isPlayerInFrakt(playerid,0))return SendClientMessage(playerid,rot,"Du bist in keiner Fraktion");
SendClientMessage(playerid,grün,"/fc");
SendClientMessage(playerid,rot,"/einladen");
SendClientMessage(playerid,grün,"/annehmen");
SendClientMessage(playerid,rot,"/spawnchange");
SendClientMessage(playerid,grün,"/einladen");
return 1;
}
ocmd:fc(playerid,params[])
{
if(isPlayerInFrakt(playerid, 0))return SendClientMessage(
playerid, rot, "Du bist in keiner Fraktion.");
new string[128];
if(sscanf(params, "s[128]", string))return SendClientMessage(
playerid, rot, "INFO: /f [nachricht]");
new fID = sInfo[playerid][fraktion];
format(string,sizeof(string), "**(( %s: %s ))**", getPlayerName(playerid), string);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))continue;
if(!isPlayerInFrakt(i, fID))continue;
SendClientMessage(i, helblau, string);
}
return 1;
}
ocmd:einladen(playerid,params[])
{
if(isPlayerInFrakt(playerid, 0))return SendClientMessage(
playerid, helblau, "Du bist in keiner Fraktion.");
if(sInfo[playerid][rang] < 6)return SendClientMessage(
playerid, helblau, "Dein Rang ist zu niedrig.");
new pID, fID;
fID = sInfo[playerid][fraktion];
if(sscanf(params, "u", pID))return SendClientMessage(
playerid, gelb, "INFO: /invite [playerid]");
if(!isPlayerInFrakt(pID, 0))return SendClientMessage(
playerid, gelb, "Spieler ist kein Zivilist.");
new string[128];
format(string,sizeof(string), "%s hat dich in die Fraktion %s eingeladen.",
getPlayerName(playerid), fInfo[fID][f_name]);
SendClientMessage(pID, gelb, string);
SendClientMessage(pID, gelb,
"Zum akzeptieren /accept invite eingeben.");
SetPVarInt(pID, "inv_fraktid", fID);
SetPVarInt(pID, "inv_inviter", playerid);
return 1;
}
ocmd:annehmen(playerid, params[])
{
new item[64];
if(sscanf(params,"s[64]",item))return SendClientMessage(
playerid, gelb, "INFO: /accept [invite]");
if(!strcmp(item, "invite", false))
{
if(GetPVarInt(playerid, "inv_fraktid") == 0)return SendClientMessage(
playerid, grün, "Du wurdest in keine Fraktion eingeladen.");
new fID = GetPVarInt(playerid, "inv_fraktid");
sInfo[playerid][fraktion] = fID;
sInfo[playerid][rang] = 1;
new string[128];
format(string,sizeof(string), "Du bist der Fraktion %s beigetreten.",
fInfo[fID][f_name]);
SendClientMessage(playerid, grün, string);
format(string,sizeof(string), "%s ist der Fraktion beigetreten.",
getPlayerName(playerid));
SendClientMessage(GetPVarInt(playerid, "inv_inviter"), grün,
string);
SetPVarInt(playerid, "inv_fraktid", 0);
return 1;
}
return 1;
}
ocmd:spawnchange(playerid,params[])
{
if(isPlayerInFrakt(playerid,0)) return SendClientMessage(playerid,rot,"Du bist in keiner Fraktion.");
if(sInfo[playerid][spawnchange] == 0)
{
sInfo[playerid][spawnchange] = 1;
}
else
{
sInfo[playerid][spawnchange] = 0;
}
savePlayer(playerid);
SendClientMessage(playerid,grün,"Spawn geändert");
return 1;
}
So sieht bis jetzt mein Fraktion-System aus.