pls help me
#1

PHP код:
CMD:gate(playeridparams[])
{
    
//  Gates
    
new donestr[265], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    for(new 
idx=1idx<MAX_GATESidx++)
    {
        new 
Float:cur[3];
        if(
GateInfo[idx][gModel])
        {
            
GetDynamicObjectPos(GateInfo[idx][gGate], cur[0], cur[1], cur[2]);
            if(
IsPlayerInRangeOfPoint(playerid8cur[0], cur[1], cur[2]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]))
            {
                if(
GateInfo[idx][gOOwned] != 0)
                {
           if(
GetPVarInt(playerid"playerorg") != 0)
                    {
                        
format(strsizeof(str), "org%d"GetPVarInt(playerid"playerorg"));
                         new 
tmp dini_Int(AddDirFile(dir_orgfilesstr), "GateOwned1");
                         new 
tmp2 dini_Int(AddDirFile(dir_orgfilesstr), "GateOwned2");
                         new 
tmp3 dini_Int(AddDirFile(dir_orgfilesstr), "GateOwned3");
                         if((
tmp == idx) || (tmp2 == idx) || (tmp3 == idx))
                         {
                            if(!
GateInfo[idx][gStatus])
                            {
                                
GateInfo[idx][gStatus] = 1;
                                
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                                
done=1;
                                break;
                            }
                            else
                            {
                                
GateInfo[idx][gStatus] = 0;
                                
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                                
done=1;
                                break;
                            }
                        }
                        else {
                            
format(strsizeof(str), "This gate has been assigned to '%s' you cant open it."GateInfo[idx][gOOwned]);
                            
SendClientMessage(playeridCOLOR_WHITEstr);
                            
done 1;
                            break;
                        }
                    }
                    else {
                        
format(strsizeof(str), "This gate has been assigned to '%s' you cant open it."GateInfo[idx][gOOwned]);
                          
SendClientMessage(playeridCOLOR_WHITEstr);
                          
done 1;
                          break;
                    }
                }
                if(
dini_Int(AddDirFile(dir_userfilesname), "GateID") == idx)
                {
                    if(!
GateInfo[idx][gStatus])
                    {
                        
GateInfo[idx][gStatus] = 1;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                        
done=1;
                        break;
                    }
                    else
                    {
                        
GateInfo[idx][gStatus] = 0;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                        
done=1;
                        break;
                    }
                }
                if(
strlen(GateInfo[idx][gPassword]))
                {
                    if(
sscanf(params"s[256]"params)) return SendClientMessage(playerid0xFFFFFF00"USAGE: /gate [password]");
                    if(
strcmp(paramsGateInfo[idx][gPassword])) return SendClientMessage(playerid, -1"Invalid gate password.");
                    if(!
GateInfo[idx][gStatus])
                    {
                        
GateInfo[idx][gStatus] = 1;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                        
done=1;
                        break;
                    }
                    else
                    {
                        
GateInfo[idx][gStatus] = 0;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                        
done=1;
                        break;
                    }
                }
                else
                {
                    if(!
GateInfo[idx][gStatus])
                    {
                        
GateInfo[idx][gStatus] = 1;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                        
done=1;
                        break;
                    }
                    else
                    {
                        
GateInfo[idx][gStatus] = 0;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                        
done=1;
                        break;
                    }
                }
            }
        }
    }
    if(!
doneSendClientMessage(playerid, -1"You aren't near a gate you can open.");
    return 
1;

PHP код:
CMD:setgateo(playeridparams[])
{
 return 
cmd_setgateowner(playeridparams);
}
CMD:setgateowner(playeridparams[])
{
    new 
idxstr[256], idstring[256], name[MAX_PLAYER_NAME];
    if(
adlvl[playerid]<6) return 0;
    if(
sscanf(params"di",ididx)) return SendClientMessage(playerid0xFFFFFF00"USAGE: /setgateowner [playerid] [gateid]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_RED"Error: Invalid Player Id.");
    
GetPlayerName(idnamesizeof(name));
    if (!
dini_Exists(AddDirFile(dir_userfilesname))) return SendClientMessage2(playeridCOLOR_RED"Error: Account Doesnt Exist");
    if(!
GateInfo[idx][gModel]) return SendClientMessage(playerid, -1"Invalid gate id.");
    
dini_Unset(AddDirFile(dir_userfilesstring), "GateID");
    
dini_IntSet(AddDirFile(dir_userfilesstring), "GateID"idx);
    
format(GateInfo[idx][gOwner], 256"%s"name);
    
format(strsizeof(str), "You have setted gate %d Owned by %s",idxname);
    
SendClientMessage(playerid0xFFFFFF00str);
    
SaveGates();
    return 
1;

when i do /setgateowner this cmd says that u have setted %s owner but when i do /gate it is opening the gates if i m not owner of tht gate help me pls

PHP код:
CMD:mygate(playeridparams[])
{
    new 
donename[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    for(new 
idx=1idx<MAX_GATESidx++)
    {
        new 
Float:cur[3];
        if(
GateInfo[idx][gModel])
        {
            
GetDynamicObjectPos(GateInfo[idx][gGate], cur[0], cur[1], cur[2]);
            if(
IsPlayerInRangeOfPoint(playerid8cur[0], cur[1], cur[2]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]))
            {
                new 
gc dini_Int(AddDirFile(dir_userfilesname), "GateID");
                if(
gc == 0) return SendClientMessage(playeridCOLOR_RED"Error: This Gate doesn't belong to you.");
                {
                    if(
gc == idx)
                    {
                        if(!
GateInfo[idx][gStatus])
                        {
                        
GateInfo[idx][gStatus] = 1;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                        
done=1;
                        break;
                        }
                        else
                        {
                        
GateInfo[idx][gStatus] = 0;
                        
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                        
done=1;
                        break;
                        }
                    }
                }
            }
        }
    }
    if(!
doneSendClientMessage(playeridCOLOR_WHITE"Error: You aren't near a gate you can open.");
    return 
1;

pls help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)