12.12.2011, 16:06
I have problem with /bribe and /accept command for cops ... Bribe command works fine , but when i do /accept it relase ME from jail instead of person who offered me bribe ... i can not define other player in /accept command ...here's code
So problem is in that /accept command..
Thanks in advance
Код:
dcmd_bribe(playerid,params[]) { new string[128]; new ID, amount; if(sscanf(params, "ui", ID, amount)) { SendClientMessage(playerid,COLOR_RED,"USAGE: /bribe (Player Name/ID) (Amount)"); return 1; } if(playerid == ID) { SendClientMessage(playerid,COLOR_RED,"You cannot bribe yourself!"); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command."); return 1; } if(!IsPlayerConnected(ID)) { format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot give bribe to them.",ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(gTeam[ID] == CIVILIAN) { SendClientMessage(playerid,COLOR_RED,"Only Police Officers can be bribed!"); return 1; } if(HasBribedRecently[playerid] >= 1) { SendClientMessage(playerid,COLOR_RED,"Please wait before attempting to bribe someone again."); return 1; } if(GetPlayerMoney(playerid) < amount) { SendClientMessage(playerid,COLOR_RED,"You do not have that amount of money!"); return 1; } if(amount > 20000 || amount < 5000) { SendClientMessage(playerid,COLOR_RED,"Please enter ammount from 5000$ up to 20.000$"); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 15) { SendClientMessage(playerid,COLOR_RED,"That player is not close enough in order bribe him."); return 1; } format(string,sizeof(string),"You have offered bribe to %s(%d).",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_SERVER,string); format(string,sizeof(string),"You have recived $%d bribe from %s (%d). /accept or /decline.",amount,PlayerName(playerid),playerid); SendClientMessage(ID,COLOR_SERVER,string); HasOfferforBribe[ID] =1; HasBribedRecently[playerid] =30; return 1; } dcmd_accept(playerid,params[]) { #pragma unused params new string[128]; new ID, amount; if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command."); return 1; } if(!IsPlayerConnected(ID)) { format(string,sizeof(string),"The Player ID (%d) is not connected to the server.",ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(HasOfferforBribe[playerid] != 1) { SendClientMessage(playerid,COLOR_RED,"You do not have any bribe offer to accept."); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 15) { SendClientMessage(playerid,COLOR_RED,"That player is not close enough in order to accept bribe."); return 1; } SendClientMessage(ID,COLOR_ORANGE,"Your bribe has been accepted . You are free to go!"); JailTime[ID] =0; TotalJailTime[ID] =0; Jailed[ID] = false; SetPlayerWantedLevel(ID, 0); SetPlayerInterior(ID, 0); SetPlayerPos(ID, 1546.0634,-1675.3385,13.5616); SetPlayerFacingAngle(ID, 13.5616); SetCameraBehindPlayer(ID); GivePlayerMoney(ID, -amount); format(string, sizeof(string), "%s (%d) has been released from jail.",PlayerName(ID),ID); SendClientMessageToAll(COLOR_SERVER,string); SetPlayerHealth(ID, 100); return 1; }
Thanks in advance