PDA

View Full Version : [Tutorial] - Sistem de /robbank pe server



Royce.
01-04-2017, 09:56 AM
1. Declaram o globala

new alreadyrobbed[MAX_PLAYERS];

2. Adaugam la OnPlayerCommandTex

if(strcmp(cmd, "/rob", true) == 0)
{
if(PlayerToPoint(5.0,playerid,x,y,z))
{
if(PlayerInfo[playerid][pLevel] != 3)
{
if(alreadyrobbed[playerid] == 0)
{
SetTimer("alreadyrobbedbank", 1800000, false);
new rand = random(100000);
new axistring[256];
new gzstring[256];
new atxstring[256];
GivePlayerMoney(playerid, rand);
GetPlayerName(playerid, playername, sizeof(playername));
format(axistring, sizeof(axistring), "{ff3300}[News]{ff0000}Banca Los Santos a fost jefuita de {ffff33}%s.", playername);
SendClientMessageToAll(COLOR_LIGHTBLUE, axistring);
format(gzstring, sizeof(gzstring), "{ff3300}[News]{ff0000}El a sustras din seif suma de {ffff33}$%d{ff0000}.Politistii sunt pe urmele lui", rand);
SendClientMessageToAll(COLOR_LIGHTBLUE, gzstring);
format(atxstring, sizeof(atxstring), " {0000ff}* Ai extras din seiful bancii suma de {ffff33}$%d{0000ff}. Acum fugi cu banii !", rand);
SendClientMessage(playerid, COLOR_LIGHTBLUE, atxstring);
alreadyrobbed[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Banca a fost deja jefuita.");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You must have level 3.");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Nu esti langa seiful bancii.");
}
}


x,y,z le inlocuiti voi cu coordonatele voastre.

3. Facem un timer care sa dea posibilitatea de a jefui din nou.

Code:
forward alreadyrobbedbank(playerid);
public alreadyrobbedbank(playerid)
{
alreadyrobbed[playerid] = 1;
}