SA-MP Forums Archive
OnPlayerKeyStateChange - 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)
+--- Thread: OnPlayerKeyStateChange (/showthread.php?tid=502024)



OnPlayerKeyStateChange - Carxi - 21.03.2014

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;




Re: OnPlayerKeyStateChange - Sascha - 21.03.2014

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