FiveGame SA:MP GameMod, TutorialeConectare

Ne jucam impreuna de peste 3 ani !


FiveGame SA:MP Daca aveti orice fel de intrebari nu ezitati sa ne contactati. O zi buna, Echipa FiveGame.forumotion.com
93.119.26.230:7777

Distribuiţi

description[Tutorial/SA:MP] Sistem FactionWarn

more_horiz
Salut,
M-am gandit sa va postez un tutorial cu sistemul de FactionWarn


1. Adaugam la "enum pInfo" urmatorul lucru:

pFactionWarn,

2. Adaugam la "public OnPlayerConnect" urmatorul lucru:

PlayerInfo[playerid][pFactionWarn] = 0;

3. Adaugam la "public OnPlayerRegister" urmatorul lucru:

format(var, 32, "FactionWarn=%d\n",PlayerInfo[playerid][pFactionWarn]);fwrite(hFile, var);

4. Adaugam la "public OnPlayerUpdate" urmatorul lucru:

format(var, 32, "FactionWarn=%d\n",PlayerInfo[playerid][pFactionWarn]);fwrite(hFile, var);

5. Adaugam la "public OnPlayerLogin" urmatorul lucru:

if( strcmp( key , "FactionWarn" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFactionWarn] = strval( val ); }

6. Adaugam la comanda /uninvite urmatorul lucru:

PlayerInfo[para1][pFactionWarn] = 0;

7. Adaugam langa celelalte comenzi urmatoarele comenzi:


if(strcmp(cmd, "/factionwarn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /factionwarn [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 5 || PlayerInfo[playerid][pLeader] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /factionwarn [playerid/PartOfName] [reason]");
return 1;
}
PlayerInfo[giveplayerid][pFactionWarn] += 1;
if(PlayerInfo[giveplayerid][pFactionWarn] >= 3)
{
PlayerInfo[giveplayerid][pFactionWarn] = 0;
gTeam[giveplayerid] = 3;
PlayerInfo[giveplayerid][pTeam] = 3;
PlayerInfo[giveplayerid][pMember] = 0;
PlayerInfo[giveplayerid][pRank] = 0;
PlayerInfo[giveplayerid][pChar] = 0;
new rand = random(sizeof(CIV));
SetSpawnInfo(giveplayerid, gTeam[giveplayerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[giveplayerid][pModel] = CIV[rand];
MedicBill[giveplayerid] = 0;
SpawnPlayer(giveplayerid);
return 1;
}
format(string, sizeof(string), "You faction warned %s, reason: %s", giveplayer, (result));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You were faction warned by %s, reason: %s", sendername, (result));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "Leader Bot: %s a primit Faction Warn de la %s pentru motivul %s", giveplayer, sendername, (result));
ABroadCast(COLOR_YELLOW,string,1);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), "That player is not connected", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}



if(strcmp(cmd, "/unfactionwarn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /unfactionwarn [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /unfactionwarn [playerid/PartOfName] [reason]");
return 1;
}
PlayerInfo[giveplayerid][pFactionWarn] -= 1;
format(string, sizeof(string), "You Faction UnWarned %s", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You were Faction UnWarned by %s", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "Leader Bot: %s a primit UnFaction Warn de la %s pentru motivul %s", giveplayer, sendername, (result));
ABroadCast(COLOR_YELLOW,string,1);
return 1;
}
} // Not Connected
}
else
{
format(string, sizeof(string), "%d is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}



if(strcmp(cmd, "/viewfactionwarn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pFactionWarn] > 0)
{
new FW = PlayerInfo[playerid][pFactionWarn];
format(string, sizeof(string), "You have %d/3 Faction Warn(s)", FW);
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You have not a Faction Warn");
}
}
return 1;
}


if (strcmp(cmd, "/checkfactionwarn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 5 || PlayerInfo[playerid][pLeader] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /checkfactionwarn [playerid/PartOfName]");
return 1;
}
//giveplayerid = strval(tmp);
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new FW = PlayerInfo[giveplayerid][pFactionWarn];
format(string, sizeof(string), "This player has %d/3 Faction Warn(s)", FW);
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "AdmCmd: %s a primit /checkfactionwarn de la %s", giveplayer, sendername);
ABroadCast(COLOR_RED,string,1);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "No Such Player");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not a Leader");
}
}
return 1;
}

FiveGame RPG

FiveGame RPG


IP: [Trebuie sa fiti inscris si conectat pentru a vedea acest link]
 
[Trebuie sa fiti inscris si conectat pentru a vedea acest link]t

[Trebuie sa fiti inscris si conectat pentru a vedea acest link]
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum