OnPlayerKeyStateChange
#1

I have a problem, when I use KEY_WALK for different things does not work anymore.
This is my KEY
PHP код:
if(newkeys == KEY_WALK)
{
if(
IsLaw(playerid) || IsMedic(playerid) || IsGov(playerid))
    {
       if(
IsPlayerInRangeOfPoint(playerid,7.5,1526.51, -1666.616.23) && IsLaw(playerid) || IsPlayerInRangeOfPoint(playerid,7.5,323.8577,309.6570,999.1484) && IsLaw(playerid) || IsPlayerInRangeOfPoint(playerid,7.5,255.5094,73.7708,1003.6406) && IsLaw(playerid) || IsPlayerInRangeOfPoint(playerid,7.5,1134.3662,-2541.4697,1113.8115) && IsMedic(playerid) || IsPlayerInRangeOfPoint(playerid,7.5,-688.4454,937.7852,13.6328) && IsGov(playerid))
        {
            
ToggleDuty(playerid,DUTY_TYPE_NORM);
            return 
1;
        }
    }
    else
    {
        
SendErrorMsg(playerid,"Non sei un agente/medico/membro del governo.");
        return 
1;
    }
}
 if(
newkeys == KEY_WALK)
{
    new 
house GetClosestHouse(playerid);
    if(
house == -1) { house in_house[playerid]; }
    if(
house > -1)
    {
        if(!
IsHouseOwner(playerid,house) && !IsRentingHouse(playerid,house))
        {
            new 
str[256];
            
format(str,sizeof(str),"Compra Casa [$%d]\nAffitta Casa [$%d]",HouseInfo[house][hPrice],HouseInfo[house][hRentPrice]);
            
ShowPlayerDialog(playerid,DIALOG_STYLE_LIST,DIALOG_HOUSE,"Azioni disponibili casa",str,"Ok","Annulla");
            return 
1;
        }
        else
        {
            new 
str[256]; new tmp[256];
            if(
HouseInfo[house][hLocked]) { strins(str,"Apri Porta\n",strlen(str)); } else { strins(str,"Chiudi Porta\n",strlen(str)); }
            new 
rentable[16];
            if(
HouseInfo[house][hRentable])
            {
                
format(rentable,sizeof(rentable),"Si");
            }
            else
            {
                
format(rentable,sizeof(rentable),"No");
            }
            if(
IsRentingHouse(playerid,house)) { strins(str,"Disaffitta Casa\n",strlen(str)); } else if(IsHouseOwner(playerid,house)) { format(tmp,sizeof(tmp),"Vendi Casa [$%d]\nRitira Soldi [$%d]\nCosto Affitto\n\nResidenti\nMigliora\nSetta affitto [%s]",((60 HouseInfo[house][hPrice]) / 100),HouseInfo[house][hBank],rentable); strins(str,tmp,strlen(str)); }
            
ShowPlayerDialog(playerid,DIALOG_STYLE_LIST,DIALOG_HOUSE,"Azioni disponibili",str,"Ok","Annulla");
            return 
1;
        }
    }
    new 
biz GetClosestBiz(playerid);
    if(
biz == -1) { biz in_biz[playerid]; }
    if(
biz > -1)
    {
        if(
BizInfo[biz][bOwner] == 0)
        {
            new 
str[256];
            
format(str,sizeof(str),"Compra Business [$%d]",BizInfo[biz][bPrice]);
            
ShowPlayerDialog(playerid,DIALOG_BIZ,DIALOG_STYLE_LIST,"Azioni disponibili...",str,"Conferma","Annulla");
            return 
1;
        }
        else if(
IsBusinessOwner(playerid,biz))
        {
            new 
str[256];
            new 
tmp[256];
            if(
BizInfo[biz][bOpen]) { strins(str,"Chiudi Business\n",strlen(str)); } else { strins(str,"Apri Business\n",strlen(str)); }
            if(
BizInfo[biz][bType] == BIZ_TYPE_FUEL) { strins(str,"Set Fuel Price\n",strlen(str)); }
            
strins(str,"Finanza Business\n",strlen(str));
            
format(tmp,sizeof(tmp),"Vendi Business [$%d]\n",((60 BizInfo[biz][bPrice]) / 100));
            
strins(str,tmp,strlen(str));
            
format(tmp,sizeof(tmp),"Modifica Nome Business\n");
            
strins(str,tmp,strlen(str));
            
format(tmp,sizeof(tmp),"Ritira soldi\n");
            
strins(str,tmp,strlen(str));
            if(
BizInfo[biz][bType] != BIZ_TYPE_FUEL) { format(tmp,sizeof(tmp),"Costo Entrata\n"); strins(str,tmp,strlen(str)); }
            
ShowPlayerDialog(playerid,DIALOG_BIZ,DIALOG_STYLE_LIST,"Azioni Business",str,"Conferma","Annulla");
            return 
1;
        }
    }
    return 
1;

Reply
#2

Remove the "return 1;" except of the very last one... the stop the script voing any further in that callback
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)