SA-MP Forums Archive
payticket - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: payticket (/showthread.php?tid=254451)



payticket - Admigo - 10.05.2011

heey guys.
I made a payticket command but how can i remake it that the cop get money when the player pays the ticket?
Код:
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);

	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


Re: payticket - Salmon - 10.05.2011

well with your variable architecture your going to have to store additional an variable when the cop issues the ticket such as

Код:
TicketCopName[playerid]
use the cops name to check against to insure that random money doesn't go flying around the server.

check if the cop is online then send them (x%)2000 money.

if they are not online don't send the money out.

This isn't the cleanest way to do it, but it will work as far as your concerned


Re: payticket - Admigo - 10.05.2011

Can you give a explain?


Re: payticket - Salmon - 10.05.2011

um ok it will be awhile,

does your cop have to issue a ticket to the person? or does the person gain a "ticket" wanted level

when the player wants to do pay ticket is it just going to the closest cop?


Re: payticket - Admigo - 11.05.2011

Yeah i made a key for it