Changing command into key
#1

I need some help on changing the command into a key . Example if someone press shift he does that command .

PHP код:
dcmd_pay(playerid,params[])
{
    
#pragma unused params
    
new rand random(GetPlayerMoney(playerid)),Float:x,Float:y,Float:z,string[100];
    while(
rand GetPlayerMoney(playerid))
    if(
gTeam[playerid] != TEAM_POLICE) return SendClientMessage(playerid,red,"ERROR: "lgrey"You aren't a police man!");
    if(
hastickettopay[playerid] == 0) return SendClientMessage(playerid,red,"You dont have a ticket to pay!");
    if(
GetPlayerWantedLevel(playerid) > 2) return SendClientMessage(playerid,red,""lgrey"You cant pay your ticket! You have a high wanted level"lyellow2"(/arrest)");
    
format(string,sizeof(string),""lred"You aren't near "lyellow2"%s",GetPName(Ticketid[playerid]));
    
GetPlayerPos(Ticketid[playerid],x,y,z);
    if(
IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playerid,red,string);
    
GivePlayerMoney(Ticketid[playerid],rand);
    
GivePlayerMoney(playerid,-rand);
    
KillTimer(Ticket[playerid]);
    
hastickettopay[playerid] = 0;
    
SendFMessage(playerid,red,"",GetPName(Ticketid[playerid]),rand);
    
SendFMessage(Ticketid[playerid],red,"%s has paid $%i for his ticket",GetPName(playerid),rand);
    return 
1;

I wanna that if player press the "shift" button , all this happends ..
Reply
#2

PHP код:
if(newkeys == KEY_FIRE)
{
  new 
rand random(GetPlayerMoney(playerid)),Float:x,Float:y,Float:z,string[100];
    while(
rand GetPlayerMoney(playerid))
    if(
gTeam[playerid] != TEAM_POLICE) return SendClientMessage(playerid,red,"ERROR: "lgrey"You aren't a police man!");
    if(
hastickettopay[playerid] == 0) return SendClientMessage(playerid,red,"You dont have a ticket to pay!");
    if(
GetPlayerWantedLevel(playerid) > 2) return SendClientMessage(playerid,red,""lgrey"You cant pay your ticket! You have a high wanted level"lyellow2"(/arrest)");
    
format(string,sizeof(string),""lred"You aren't near "lyellow2"%s",GetPName(Ticketid[playerid]));
    
GetPlayerPos(Ticketid[playerid],x,y,z);
    if(
IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playerid,red,string);
    
GivePlayerMoney(Ticketid[playerid],rand);
    
GivePlayerMoney(playerid,-rand);
    
KillTimer(Ticket[playerid]);
    
hastickettopay[playerid] = 0;
    
SendFMessage(playerid,red,"",GetPName(Ticketid[playerid]),rand);
    
SendFMessage(Ticketid[playerid],red,"%s has paid $%i for his ticket",GetPName(playerid),rand);
    return 
1

Reply
#3

Pawno crashed but i have already tried that .
Reply
#4

pawn Код:
public OnPlayerKeyStateChange(playerid, oldkeys, newkeys) {
    if(newkeys & THE_KEY_YOU_WANT) {
        CallLocalFunction("OnPlayerCommandText", "ds", playerid, "/pay");
    }
}
Reply
#5

Код:
D:\Downloads\Trucking_Server_2.0\gamemodes\Trucking.pwn(15186) : error 017: undefined symbol "SUBMISSION"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
EDIT : Fixed !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)