Exiled - Gaming Romania este o comunitate bazata pe gaming-ul profesionist.


[Tutorial] Sa-pm Sistem Faction Warn

 



Vezi subiectul anterior Vezi subiectul urmator In jos   Mesaj • Pagina 1 din 1

z3!uSs
#1

la data de Mier Ian 09, 2013 1:19 pm

avatar
Exiled Skill +4
Exiled Skill +4
Salut,
M-am gandit sa va postez un tutorial cu sistemul de FactionWarn

1. Adaugam la "enum pInfo" urmatorul lucru:

Cod:
pFactionWarn,

2. Adaugam la "public OnPlayerConnect" urmatorul lucru:

Cod:
PlayerInfo[playerid][pFactionWarn] = 0;

3. Adaugam la "public OnPlayerRegister" urmatorul lucru:

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

4. Adaugam la "public OnPlayerUpdate" urmatorul lucru:

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

5. Adaugam la "public OnPlayerLogin" urmatorul lucru:

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

6. Adaugam la comanda /uninvite urmatorul lucru:

Cod:
PlayerInfo[para1][pFactionWarn] = 0;

7. Adaugam langa celelalte comenzi urmatoarele comenzi:


Cod:
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;
}



ELIMINAT
Vezi profilul utilizatorului
stefanut5
#2

la data de Mier Ian 09, 2013 2:04 pm

avatar
Exiled Skill +2
Exiled Skill +2
Bravo..Pt munca depusa :D



Viata este ca mersul pe bicicleta..Incearca sa iti menti echilibrul..
Vezi profilul utilizatorului
reLax
#3

la data de Mier Ian 09, 2013 2:23 pm

avatar
Exiled Skill +4
Exiled Skill +4
Bravo,pentru tutorial



Nu uitati ca pe forum, sunt Fondator.
Nu uitati ca pe forum, respect regulile la sange !
Nu uitati ca desi unii ma considerati prietenos, regulile sunt reguli si nu fac exceptie pentru nimeni !
Nu ofer support prin PM!


Vezi profilul utilizatorului
z3!uSs
#4

la data de Mier Ian 09, 2013 2:39 pm

avatar
Exiled Skill +4
Exiled Skill +4
Ms



ELIMINAT
Vezi profilul utilizatorului
Continut sponsorizat
#5


Vezi subiectul anterior Vezi subiectul urmator Sus   Mesaj • Pagina 1 din 1