[CAMPANIE STAFF]Cautam moderatori si designeri activi!
Welcome to WTFCS Community Forums!
Servere gaming la super-preturi! [HOSTING SERVICE]
-->






[Tutorial] Adaugare comenzi /afk /back si /afklist
Author : SaTaNa99, Category : Tutoriale, 0 Replyes, 1085 Views
EVALUATE THIS TOPIC
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1 Guest(s)
fondator rsp.wtfcs.com
 
421
POSTS
150
THREADS
0
REPUTATION
Male
Sex

WtfCs Coins: -0.01[w]
01-09-2014, 11:01 AM
#1
Stiu ca sunteti cativa curiosi cum adaugati comenzile /afk /back si /afklist in GM.. asa ca m-am gandit sa fac un tutorial! :)!
* Comanda " /afk " - cand scrieti comanda asta va pune afk , nu va mai puteti misca , si o sa fiti cu o culoare diferita de cea a factiuni
* Comanda " /back " - cand scrieti comanda asta reveniti cum erati inainte , mai bine zis iesiti din afk .
* Comanda " /afklist " - cand scrieti comanda asta va arata toti playeri online care sunt afk .

Mergem la functiile definite prin:
new de la inceputul modului si adaugam
Pawno code:

new afk[MAX_PLAYERS];. Dupa aceea mergem la
public OnPlayerConnect(playerid) si adaugam
afk[playerid] = 0;.

Sunt 3 comenzi simple care trebuie adaugate in " pawno " :

1.Comanda "/afk" :

Pawno code:

if(strcmp(cmd, "/afk", true) == 0)
{
if(afk[playerid] == 0)
{
afk[playerid] = 1;
SetPlayerColor(playerid,0x737373FF);
TogglePlayerControllable(playerid,0);
GetPlayerName(playerid, sendername, 24);
format(string, 256, "%s is away from keyboard.", sendername);
ProxDetector(20.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
}
return 1;
}
Linia :
Pawno code:
SetPlayerColor(playerid,0x737373FF);

0x737373FF - este culoare atunci cand sunteti afk , codul asta de culoare care vi l-am dat este o culoare gri spre negru , voi puneti codu de la culoare care o doriti voi ..
Ex: COLOR_RED , COLO_LIGHTBLUE

2.Comanda "/back" :
Pawno Code:

if(strcmp(cmd, "/back", true) == 0)
{
if(afk[playerid] == 1)
{
afk[playerid] = 0;
SetPlayerToTeamColor(playerid);
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, sendername, 24);
format(string, 256, "%s is no more away from keyboard.", sendername);
ProxDetector(20.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
}
return 1;
}
3.Comanda "/afklist" :
Pawno Code:

if (strcmp("/afklist", cmdtext, true, 7) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, ".:: AFK Players ::. ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(afk[i]==1)
{
new name[128];
GetPlayerName(i, name, MAX_PLAYER_NAME);
format(string, 256, "Player: \"%s\" | ID: %d", name, i);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
}
return 1;
}



[TuToRiAL]Poarta si bariera la LSPD cu deschidere la claxon


1.Definim urmatoarele:
Pawno code:

new PDGATE;
new barrier;ç

2.La "forward" definim:
Pawno code:

forward PDGATECLOSE();
forward outbarrier();

3.Creem obiectele:
Pawno code:
barrier=CreateObject(968, 1544.674683, -1630.826538, 12.992054, 0.0000, 269.7592, 269.7592);
PDGATE=CreateObject(980, 1588.421631, -1638.088257, 14.655367, 0.0000, 0.0000, 180.0000);

4.Sub public Addson() definim:
Pawno code:

public outbarrier()
{
SetObjectRot(barrier, 0, 270, 270);
return 1;
}

public PDGATECLOSE()
{
MoveObject(PDGATE, 1588.421631, -1638.088257, 14.655367,2);
return 1;
}

5. La "public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)" definim:
Pawno code:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_CROUCH)
{
if(IsPlayerInAnyVehicle(playerid))
{
if((IsACop(playerid)) && PlayerToPoint(15, playerid,1541.8696,-1628.0836,13.3828))
{
SetObjectRot(barrier, 0, 0, 270);
SetTimer("outbarrier", 6000, false);
}
if((IsACop(playerid)) && PlayerToPoint(15.0, playerid, 1588.2966,-1637.8121,13.4255))
{
MoveObject(PDGATE,1597.846802, -1638.088257, 14.655367,2);
SetTimer("PDGATECLOSE", 10000, false);
}

Asa se face poarta si bariera cu deschidere din claxon.
Regulament forum: You are not allowed to view links. Register or Login to view.

You are not allowed to view links. Register or Login to view.

You are not allowed to view links. Register or Login to view.


Forum Jump: