Íme:
#include a_samp
#include zcmd
#include sscanf
new bool:rabolhat[MAX_PLAYERS] = true;
forward rtimer(playerid);
CMD:meglop(playerid, params[])
{
new giveplayerid, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[200], string2[200], Float:x, Float:y, Float:z;
new sikerul = random(2);
if(sikerul == 1)
{
if(rabolhat[playerid] == true)
{
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(giveplayerid, name2, sizeof(name2));
GetPlayerPos(playerid, x, y, z);
if(sscanf(params, \"u\", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, \"Használat: /meglop [playerid]\");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, \"Hiba: Nincs ilyen játékos!\");
if(!IsPlayerInRangeOfPoint(giveplayerid, 3.0, x,y,z)) return SendClientMessage(playerid, 0xFF0000AA, \"Hiba: A játékos nincs a közeledben.\");
GivePlayerMoney(playerid, GetPlayerMoney(giveplayerid));
GivePlayerMoney(giveplayerid, -GetPlayerMoney(giveplayerid));
format(string, sizeof string, \"%s meglopta %s-t!\", name, name2);
SendClientMessageToAll(0x00ff1eAA,string);
format(string2, sizeof string2, \"Megloptad %s-t!\", name2);
SendClientMessage(playerid, 0x00ff1eAA, string2);
rabolhat[playerid] = false;
SetTimerEx(\"rtimer\",3*60000,false,\"i\",playerid);
}else{
SendClientMessage(playerid, 0xFF0000AA, \"Nem rég raboltál.\");
}
}else{
format(string, sizeof string, \"%s megpróbálta meglopni %s-t!\", name, name2);
SendClientMessageToAll(0x00ff1eAA,string);
format(string2, sizeof string2, \"Megpróbáltad kirabolni %s-t, de nem sikerült!\", name2);
SendClientMessage(playerid, 0xFF0000AA, string2);
}
return 1;
}
public rtimer(playerid)
{
rabolhat[playerid] = true;
SendClientMessage(playerid, 0x00ff1eAA, \"Újra rabolhatsz!\");
return 1;
}