Gate duplicate
#8

Quote:
Originally Posted by oMa37
Посмотреть сообщение
PHP код:
else if(strcmp(x_job"closed"true) == 0)
        {
            foreach(
Playeri)
            {
                if(
GetPVarInt(i"EditingGateID") == gateid && != playerid)
                {
                    
format(stringsizeof(string), "ERROR: %s (ID: %d) is currently editing this gate."GetPlayerNameEx(i), i);
                    return 
SendClientMessageEx(playeridCOLOR_WHITEstring);
                }
            }
            
SetPVarInt(playerid"gEdit"2);
            
SetPVarInt(playerid"EditingGateID"gateid);
            
EditDynamicObject(playeridGateInfo[gateid][gGATE]);
            
format(stringsizeof(string), "You are now editing the closed position of Gate %d."gateid);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
SendClientMessage(playerid0xFFFFAAAA"HINT: Hold {8000FF}~k~~PED_SPRINT~ {FFFFAA}to move your camera, press escape to cancel");
        } 
Here you are setting the gEdit pVar to 2.

PHP код:
        if(GetPVarInt(playerid"gEdit") == 2)
        {
            if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessageEx(playeridCOLOR_GREY"You are not authorized to perform this action!");
            new 
gateid GetPVarInt(playerid"EditingGateID");
            
GateInfo[gateid][gPosXM] = x;
            
GateInfo[gateid][gPosYM] = y;
            
GateInfo[gateid][gPosZM] = z;
            
GateInfo[gateid][gRotXM] = rx;
            
GateInfo[gateid][gRotYM] = ry;
            
GateInfo[gateid][gRotZM] = rz;
            
CreateGate(gateid);
            
SaveGates();
            
format(stringsizeof(string), "You have finished editing the closed position of Gate ID: %d"gateid);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
DeletePVar(playerid"gEdit");
            
DeletePVar(playerid"EditingGateID");
        } 
And here you are checking if the pVar == 2, And re-creating the Gate + saving it.

You may understand now why it duplicate.
So what do I need to do to fix this ?
Reply


Messages In This Thread
Gate duplicate - by IndependentGaming - 20.09.2016, 16:22
Re: Gate duplicate - by IndependentGaming - 20.09.2016, 17:47
Re: Gate duplicate - by oMa37 - 20.09.2016, 17:52
Re: Gate duplicate - by IndependentGaming - 20.09.2016, 17:53
Re: Gate duplicate - by Shinja - 20.09.2016, 21:59
Re: Gate duplicate - by IndependentGaming - 21.09.2016, 15:03
Re: Gate duplicate - by oMa37 - 21.09.2016, 15:11
Re: Gate duplicate - by IndependentGaming - 21.09.2016, 15:31

Forum Jump:


Users browsing this thread: 1 Guest(s)