SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/03/2012, 06:12 PM   #1
Admigo
High-roller
 
Admigo's Avatar
 
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,745
Reputation: 198
Default Ticket key work And PayTicket key dont work.

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;
           }
How can i fix this?

Thanks Admigo
__________________
0.4a RC. We are waiting for you

Admigo is offline   Reply With Quote
Old 26/03/2012, 07:14 PM   #2
Admigo
High-roller
 
Admigo's Avatar
 
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,745
Reputation: 198
Default Re: Ticket key work And PayTicket key dont work.

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;
}
How can i change this command to the key KEY_FIRE?

Thanks Admigo
__________________
0.4a RC. We are waiting for you

Admigo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


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 08:50 AM


All times are GMT. The time now is 11:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.