SA-MP Forums Archive
Help with Gates - 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: Help with Gates (/showthread.php?tid=344072)



Help with Gates - miley1 - 19.05.2012

So i was Creating Simple Gates for a faction and i wanted to make that they can only open it near that distance So i made it But it still says You have opendt the door , how can i make it say You are not near this Gate


The lines

PHP код:
    if(strcmp(cmd,"/Yamao2",true)==0)
    {
            if(
PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
            {
         
MoveDynamicObject(rallon4658.40002441406, -1226.699951171922.399999618531.5);
        
SetTimer("GateCloseBMS"80000);
        
format(stringsizeof(string), "* %s takes his/her remote and opens the gate."sendername);
        
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
        
SendClientMessage(playeridCOLOR_ORANGE"The gate is opened and will close in few seconds.");
          }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"You don't have a remote that could open the gate!");
        }
        return 
1;
    } 



Re: Help with Gates - SnG.Scot_MisCuDI - 19.05.2012

NOT TESTED


pawn Код:
if(strcmp(cmd,"/Yamao2",true)==0)
    {
        if (IsPlayerInRangeOfPoint(playerid, 20, 658.40002441406, -1226.6999511719, 22.39999961853)) && if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
       
    {
        MoveDynamicObject(rallon4, 658.40002441406, -1226.6999511719, 22.39999961853, 1.5);
    }
        SetTimer("GateCloseBMS", 8000, 0);
        format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
        SendClientMessage(playerid, COLOR_ORANGE, "The gate is opened and will close in few seconds.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You don't have a remote that could open the gate!");
        }
        return 1;

    }



Re: Help with Gates - ReneG - 19.05.2012

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
NOT TESTED


pawn Код:
if(strcmp(cmd,"/Yamao2",true)==0)
    {
        if (IsPlayerInRangeOfPoint(playerid, 20, 658.40002441406, -1226.6999511719, 22.39999961853)) && if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
       
    {
        MoveDynamicObject(rallon4, 658.40002441406, -1226.6999511719, 22.39999961853, 1.5);
    }
        SetTimer("GateCloseBMS", 8000, 0);
        format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
        SendClientMessage(playerid, COLOR_ORANGE, "The gate is opened and will close in few seconds.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You don't have a remote that could open the gate!");
        }
        return 1;

    }
What the hell is up with your indentation?

@OP the MoveObject native had 3 new rotation parameters in 0.3d, you only gave 5.
pawn Код:
if(strcmp(cmd,"/Yamao2",true)==0)
{
    if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
    {
        if(IsPlayerInRangeOfPoint(playerid, 8.0, 658.40002441406, -1226.6999511719, 22.39999961853))
        {
            MoveDynamicObject(rallon4, 658.40002441406, -1226.6999511719, 22.39999961853, 1.5, 0.0, 0.0, 0.0);
            SetTimer("GateCloseBMS", 8000, 0);
            format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
            SendClientMessage(playerid, COLOR_ORANGE, "The gate is opened and will close in few seconds.");
            return 1;
        }
        else SendClientMessage(playerid, -1, "You are not near the gate.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You don't have a remote that could open the gate!");
    }
    return 1;
}



Re: Help with Gates - miley1 - 20.05.2012

Lose Identitation


Quote:

if(strcmp(cmd,"/Yamao2",true)==0)
{
if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 658.40002441406, -1226.6999511719, 22.39999961853))
{
MoveDynamicObject(rallon4, 658.40002441406, -1226.6999511719, 22.39999961853, 1.5, 0.0, 0.0, 0.0);
SetTimer("GateCloseBMS", 8000, 0);
format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
SendClientMessage(playerid, COLOR_ORANGE, "The gate is opened and will close in few seconds.");
return 1;
}
else SendClientMessage(playerid, -1, "You are not near the gate.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You don't have a remote that could open the gate!");
}
return 1;
}

hm? how i fix it

and u made them open weird lol


Re: Help with Gates - [FMJ]PowerSurge - 20.05.2012

Indent the code and you'll lose your loose indentation warnings.

Or, press TAB so the code gradually 'opens' and 'closes'.

pawn Код:
if(strcmp(cmd,"/Yamao2",true)==0)
{
    if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
    {
        if(IsPlayerInRangeOfPoint(playerid, 8.0, 658.40002441406, -1226.6999511719, 22.39999961853))
        {
            MoveDynamicObject(rallon4, 658.40002441406, -1226.6999511719, 22.39999961853, 1.5, 0.0, 0.0, 0.0);
            SetTimer("GateCloseBMS", 8000, 0);
            format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
            SendClientMessage(playerid, COLOR_ORANGE, "The gate is opened and will close in few seconds.");
            return 1;
        }
        else SendClientMessage(playerid, -1, "You are not near the gate.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You don't have a remote that could open the gate!");
    }
    return 1;
}



Re: Help with Gates - miley1 - 20.05.2012

Can you turn the right code into PHP pawno doesnt allowds me to copy and paste into my gamemode it will fail