|
|
#1 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2010
Location: The Netherlands
Posts: 1,482
Reputation: 71
|
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: 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 |
|
|
|
|
|
#2 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2010
Location: The Netherlands
Posts: 1,482
Reputation: 71
|
Here is my Command:
Code:
dcmd_payticket(playerid,params[])
{
#pragma unused params
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_DEADCONNECT,"[[_Ticket Paid_]]");
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;
}
Thanks Admigo |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My Server work on Windows and dont work on linux | Justinlol | Help Archive | 10 | 14/08/2011 01:43 PM |
| Ticket and Payticket command | Admigo | Help Archive | 4 | 14/05/2011 12:27 AM |
| Can you tell me why my cmd dont work | zack3021 | Help Archive | 2 | 08/09/2010 05:47 PM |
| [Help] /rac dont work | whitedragon | Help Archive | 3 | 06/02/2010 07:50 AM |