ticket && pay mess up<.<
#1

pawn Код:
CMD:ticket(playerid, params[])
{
    new giveplayerid;
    if (sscanf(params, "u", giveplayerid)) SendClientMessage(playerid, 0xFF0000FF, "[INFO] Usage: /Ticket [ID]");
    else if (!IsPlayerConnected(giveplayerid)) SendClientMessage(playerid, 0xFF0000FF, "[INFO] Invalid ID");
    else if (GetPlayerWantedLevel(giveplayerid) == 0) SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Is Not A Suspected Player");
    else if (TicketTo[playerid]!=999) SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket.");
    else if (TicketFrom[giveplayerid] != 999) SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket");
    else
    if (GetPlayerWantedLevel(giveplayerid) >= 1)
    {
        TicketTo[playerid] = giveplayerid;
        TicketFrom[giveplayerid] = playerid;
        new bname[128];
        new tmp[128];
        GetPlayerName(playerid, bname, sizeof(bname));
        format(tmp,128,"[INFO] Officer %s Has Ticketed you",bname);
        SendClientMessage(giveplayerid, COLOR_YELLOW, tmp);
        SendClientMessage(giveplayerid, COLOR_YELLOW, "[INFO] Do /pay To Pay The Ticket!");
        SendClientMessage(playerid, COLOR_GREEN, "[INFO] Player Ticketed");
    }
    else if (GetPlayerWantedLevel(giveplayerid) > 3)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Error: %s(%d) Does Not Have A Warrant Please Use /tk [playerid]");
    return 1;
    }
    return 1;
}
CMD:pay(playerid, params[])
{
    if(gTeam[playerid] == TEAM_COPS)
    {
        if(Ticket[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_RED, "[INFO] You Don't Have A Ticket.");
        }
        else
        {
            new bname[128];
            GetPlayerName(playerid, bname, sizeof(bname));
            new string[128];
            new randmoney = random(2300);
            GivePlayerMoney(playerid,randmoney);
            GivePlayerMoney(TicketFrom[playerid], -randmoney);
            format(string, sizeof(string), "Officer %s Has Ticketed You %s Cash Type /pay To Pay The Ticket", bname,randmoney);
            SendClientMessage(playerid, WHITE, string);
            SetPlayerWantedLevel(TicketFrom[playerid], 0);
            TicketTo[TicketFrom[playerid]] = 999;
            Ticket[playerid] = 0;
            TicketFrom[playerid] = 999;
        }
    }
    return 1;
}
doesnt work returns wrong shit
Reply
#2

Try this code:

Your ticket command:
Код:
CMD:ticket(playerid, params[])
{    
	new giveplayerid;    
	
	if (sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Usage: /Ticket [ID]");    
 	if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Invalid ID");    
	if (GetPlayerWantedLevel(giveplayerid) == 0) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Is Not A Suspected Player");    
	if (TicketTo[playerid]!=999) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket.");    
	if (TicketFrom[giveplayerid] != 999) return SendClientMessage(playerid, 0xFF0000FF, "[INFO] That Player Already Has A Ticket");    
	if (GetPlayerWantedLevel(giveplayerid) > 3) return SendClientMessage(playerid, 0xFF0000AA, "Error: %s(%d) Does Not Have A Warrant Please Use /tk [playerid]");	

	      
	TicketTo[playerid] = giveplayerid;        
	TicketFrom[giveplayerid] = playerid;        
	new bname[128];        
	new tmp[128];        
	GetPlayerName(playerid, bname, sizeof(bname));        

	format(tmp,128,"[INFO] Officer %s Has Ticketed you",bname);        
	SendClientMessage(giveplayerid, COLOR_YELLOW, tmp);        
	SendClientMessage(giveplayerid, COLOR_YELLOW, "[INFO] Do /pay To Pay The Ticket!");        
	SendClientMessage(playerid, COLOR_GREEN, "[INFO] Player Ticketed");

	return 1;	        
	
}
Your pay command:
Код:
CMD:pay(playerid, params[])
{    
	if(gTeam[playerid] == TEAM_CIVILIANS)
	{        
		if(Ticket[playerid] == 0)        
		{            
			SendClientMessage(playerid, COLOR_RED, "[INFO] You Don't Have A Ticket.");        
		}        
	}
	new bname[128];            
	GetPlayerName(playerid, bname, sizeof(bname));            
	new string[128];           
	new randmoney = random(2300);            
	GivePlayerMoney(playerid,randmoney);            
	GivePlayerMoney(TicketFrom[playerid], -randmoney);            
	format(string, sizeof(string), "Officer %s Has Ticketed You %s Cash Type /pay To Pay The Ticket", bname,randmoney);            
	SendClientMessage(playerid, WHITE, string);            
	SetPlayerWantedLevel(TicketFrom[playerid], 0);            
	TicketTo[TicketFrom[playerid]] = 999;            
	Ticket[playerid] = 0;            
	TicketFrom[playerid] = 999;        
    
   	return 1;
}
Reply
#3

woops.>.< thats surpose to be team_civilian lol o and how do i set a timer like.. if the ticketed player does not pay the ticket withen 30 seconds setwantedlvl ++
Reply
#4

At top of script:
Код:
new timer;
When you issue the ticket,
Код:
timer = SetTimerEx("increasewl",30000,0,"i",playerid);
Under your pay command:
Код:
KillTimer(timer);
The function:

Код:
forward increasewl(playerid);

public increasewl(playerid)
{
    new wl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid,wl+1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)