26.03.2012, 18:12
Heey all,
I made a ticket key for cops and a payticket for civilians.
I made ticket and payticket as middle mouse button key(look_behind)
My problem:
The ticket key works great but the payticket dont work(Nothing Happens)
The payticket command works fine but not the key.(same code)
My Code:
How can i fix this?
Thanks Admigo
I made a ticket key for cops and a payticket for civilians.
I made ticket and payticket as middle mouse button key(look_behind)
My problem:
The ticket key works great but the payticket dont work(Nothing Happens)
The payticket command works fine but not the key.(same code)
My Code:
Code:
if(newkeys & KEY_LOOK_BEHIND) { if(gTeam[playerid]==TEAM_CIVIL)//payticket dont work { new string[128]; //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(IsKidnapped[playerid] == 1) //{ //SendClientMessage(playerid,COLOR_RED,"You are kidnapped. You cannot use this command."); //return 1; //} if(HasTicket[playerid] != 1) { //SendClientMessage(playerid,COLOR_RED,"You do not have a ticket to pay."); return 1; } SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have paid your ticket of $2000 and your wanted level has been removed."); SetPlayerWantedLevel(playerid,0); GivePlayerMoney(playerid,-2000); if(IsPlayerConnected(GetPVarInt(playerid, "copTicket")) && GetPVarType(playerid, "copTicket") != 0) { GivePlayerMoney(GetPVarInt(playerid, "copTicket"), 2000); DeletePVar(playerid, "copTicket"); } HasTicket[playerid] =0; TimeToPayTicket[playerid] =0; format(string,sizeof(string),"[POLICE RADIO] Suspect %s(%d) has paid their ticket of $2000 and their wanted level has been removed.",PlayerName(playerid),playerid); SendClientMessageToAllCops(string); return 1; } if(gTeam[playerid]==TEAM_COP)//payticket dont work { new ID = GetClosestPlayerToPlayer(playerid); if(GetPlayerWantedLevel(ID)==0 || GetDistanceBetweenPlayers(playerid,ID) > 4)//if this not work change || to && { SendClientMessage(playerid,COLOR_RED,"No Suspect In Range!"); return 1; } if(WantedLevel[ID]==1 || WantedLevel[ID]==2|| WantedLevel[ID]==3|| WantedLevel[ID]==4) { new string[128]; if(gTeam[playerid] != TEAM_COP) { return 1; } if(HasTicket[ID]==1) { new ticketkeynow[256]; format(ticketkeynow,sizeof(ticketkeynow),"~b~Officer %s[%d]:Pay your ticket!~n~~w~Typ ~y~/payticket~w~ To Pay Your Ticket!",PlayerName(playerid),playerid); GameTextForPlayer(ID,ticketkeynow,3000,5); return 1; } else if(HasTicket[ID]==0) { new ticketkeynow[256]; format(ticketkeynow,sizeof(ticketkeynow),"~b~Officer %s[%d] has given you a ticket!~n~~w~Typ ~y~/payticket~w~ To Pay Your Ticket!",PlayerName(playerid),playerid); GameTextForPlayer(ID,ticketkeynow,3000,5); format(string,sizeof(string),"Officer %s[%d] Has Given you A Ticket Of $2000! To Pay Your Ticket Typ /payticket ! ",PlayerName(playerid),playerid); SendClientMessage(ID,COLOR_LIGHTBLUE,string); HasTicket[ID] =1; SetPVarInt(ID, "copTicket", playerid); TimeToPayTicket[playerid] = SetTimerEx("TicketTimer", 1000*180, 0, "d", playerid); IncreasePlayerScore(playerid,1); format(string,sizeof(string),"Officer %s[%d] Has Given %s[%d] A Ticket Of $2000!",PlayerName(playerid),playerid,PlayerName(ID),ID); SendClientMessageToAllCops(string); return 1; } } return 1; }
Thanks Admigo