16.09.2009, 16:20
Hello,
I have one little problem with my /rob cmd
Everything works fine
The only wrong thing is
It is giving money to the robbed one
this is my code
i did GetPlayerMoney(userid,(random -20000));
but i dont know how to make it that it doesnt give money but actually takes it and give the exact amount to the player who robbed the other player so ("the robber")
and my question is
how can i make a timer so that someone cant use /rob everytime but after use he can use it again in 30 secs..
how to make that?
Thanks
From ekeleke
I have one little problem with my /rob cmd
Everything works fine
The only wrong thing is
It is giving money to the robbed one
this is my code
Код:
dcmd_rob(playerid, params[]) { new userid, string[128], targetsname[MAX_PLAYER_NAME], money, muggersname[MAX_PLAYER_NAME]; if (sscanf(params, "u", userid)) SendClientMessage(playerid, oranje, "USAGE: /rob [playerid]"); else { if(IsPlayerConnected(userid)) { GetPlayerMoney(userid); if(GetDistanceBetweenPlayers(playerid, userid) > 3) { SendClientMessage(playerid, donkerrood, "You're not close enough."); return 1; } if(gTeam[playerid] != TEAM_ROB) { SendClientMessage(playerid,donkerrood,"You aren't a robber!"); } if(gTeam[userid] == TEAM_ROB) { SendClientMessage(playerid,donkerrood,"You cant rob a robber"); } if(money < 0) { SendClientMessage(playerid, oranje, "That player doesn't have enough money to rob from. (0)"); return 1; } if(gTeam[playerid] == TEAM_ROB) { GetPlayerName(playerid, muggersname, sizeof(muggersname)); GetPlayerName(userid, targetsname, sizeof(targetsname)); format(string, sizeof(string), "You have robbed $%d, from %s.", money, targetsname); SendClientMessage(playerid, blauw, string); format(string, sizeof(string), "You have been 'robbed'! You have lost $%d, %s stole it.", money, muggersname); SendClientMessage(userid, donkerrood, string); GivePlayerMoney(playerid,random(20000)); GivePlayerMoney(userid,random(0-20000)); } } } return 1; }
but i dont know how to make it that it doesnt give money but actually takes it and give the exact amount to the player who robbed the other player so ("the robber")
and my question is
how can i make a timer so that someone cant use /rob everytime but after use he can use it again in 30 secs..
how to make that?
Thanks
From ekeleke