Little help
#1

Hello,
I would like to add some cmds to my Gate CMD, which can i make gate own to some family, and if they want to open it just use /gate like factions..


PHP код:
CMD:gedit(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || PlayerInfo[playerid][pShopTech] == 1)
    {
        new 
x_job[128], gateidFloat:ofloatstring[128];
        if(
sscanf(params"s[128]if"x_jobgateidofloat))
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /gedit [name] [gateid] [value]");
            
SendClientMessageEx(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
            
SendClientMessageEx(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
            return 
1;
        }
        if(
strcmp(x_job"hid"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            if(
value MAX_HOUSES) return SendClientMessageEx(playeridCOLOR_WHITE"* Invalid House ID!");
            
GateInfo[gateid][gHID] = value;
            
format(stringsizeof(string), "Gate HID assigned to %d"GateInfo[gateid][gHID]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's House ID to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"model"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            if(
value == 0)
            {
                
GateInfo[gateid][gPosX] = 0.0;
                
GateInfo[gateid][gPosY] = 0.0;
                
GateInfo[gateid][gPosZ] = 0.0;
                
GateInfo[gateid][gRotX] = 0.0;
                
GateInfo[gateid][gRotY] = 0.0;
                
GateInfo[gateid][gRotZ] = 0.0;
                
GateInfo[gateid][gPosXM] = 0.0;
                
GateInfo[gateid][gPosYM] = 0.0;
                
GateInfo[gateid][gPosZM] = 0.0;
                
GateInfo[gateid][gRotXM] = 0.0;
                
GateInfo[gateid][gRotYM] = 0.0;
                
GateInfo[gateid][gRotZM] = 0.0;
                
GateInfo[gateid][gVW] = 0;
                
GateInfo[gateid][gInt] = 0;
            }
            
GateInfo[gateid][gModel] = value;
            
format(stringsizeof(string), "Gate Model assigned to %d"GateInfo[gateid][gModel]);
            if(
IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            
CreateGate(gateid);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's Model to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"vw"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            
GateInfo[gateid][gVW] = value;
            
format(stringsizeof(string), "Gate VW assigned to %d"GateInfo[gateid][gVW]);
            if(
IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            
CreateGate(gateid);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's VW to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"int"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            
GateInfo[gateid][gInt] = value;
            
format(stringsizeof(string), "Gate Int assigned to %d"GateInfo[gateid][gInt]);
            if(
IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            
CreateGate(gateid);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's InteriorID to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"range"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            
GateInfo[gateid][gRange] = value;
            
format(stringsizeof(string), "Gate Range assigned to %d"GateInfo[gateid][gRange]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's Range to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"speed"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            
GateInfo[gateid][gSpeed] = value;
            
format(stringsizeof(string), "Gate Speed assigned to %d"GateInfo[gateid][gSpeed]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's Speed to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"posx"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosX] = value;
            
format(stringsizeof(string), "Gate PosX assigned to %f"GateInfo[gateid][gPosX]);
            
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"posy"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosY] = value;
            
format(stringsizeof(string), "Gate PosY assigned to %f"GateInfo[gateid][gPosY]);
            
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"posz"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosZ] = value;
            
format(stringsizeof(string), "Gate PosZ assigned to %f"GateInfo[gateid][gPosZ]);
            
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"posxm"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosXM] = value;
            
format(stringsizeof(string), "Gate PosXM assigned to %f"GateInfo[gateid][gPosXM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"posym"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosYM] = value;
            
format(stringsizeof(string), "Gate PosYM assigned to %f"GateInfo[gateid][gPosYM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"poszm"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gPosZM] = value;
            
format(stringsizeof(string), "Gate PosZM assigned to %f"GateInfo[gateid][gPosZM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"rotx"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotX] = value;
            
format(stringsizeof(string), "Gate RotX assigned to %f"GateInfo[gateid][gRotX]);
            
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"roty"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotY] = value;
            
format(stringsizeof(string), "Gate RotY assigned to %f"GateInfo[gateid][gRotY]);
            
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"rotz"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotZ] = value;
            
format(stringsizeof(string), "Gate RotZ assigned to %f"GateInfo[gateid][gRotZ]);
            
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"rotxm"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotXM] = value;
            
format(stringsizeof(string), "Gate RotXM assigned to %f"GateInfo[gateid][gRotXM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"rotym"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotYM] = value;
            
format(stringsizeof(string), "Gate RotYM assigned to %f"GateInfo[gateid][gRotYM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"rotzm"true) == 0)
        {
            new 
Float:value ofloat;
            
GateInfo[gateid][gRotZM] = value;
            
format(stringsizeof(string), "Gate RotZM assigned to %f"GateInfo[gateid][gRotZM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
        }
        else if(
strcmp(x_job"tome"true) == 0)
        {
            
GetPlayerPos(playerid,GateInfo[gateid][gPosX],GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
            
GateInfo[gateid][gVW] = GetPlayerVirtualWorld(playerid);
            
GateInfo[gateid][gInt] = GetPlayerInterior(playerid);
            
format(stringsizeof(string), "Gate Pos moved to %f %f %f, VW: %d INT: %d"GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ], GateInfo[gateid][gVW], GateInfo[gateid][gInt]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            if(
GateInfo[gateid][gModel] == 0)
            {
                
GateInfo[gateid][gModel] = 18631;
                
GateInfo[gateid][gRange] = 10;
                
GateInfo[gateid][gSpeed] = 5;
            }
            if(
IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            
CreateGate(gateid);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's Position."GetPlayerNameEx(playerid), gateid);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"tomem"true) == 0)
        {
            
GetPlayerPos(playerid,GateInfo[gateid][gPosXM],GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
            
format(stringsizeof(string), "Gate PosM moved to %f %f %f"GateInfo[gateid][gPosXM], GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's Moved Position."GetPlayerNameEx(playerid), gateid);
            
Log("logs/gedit.log"string);
        }
        else if(
strcmp(x_job"renderhq"true) == 0)
        {
            new 
value floatround(ofloatfloatround_round);
            
GateInfo[gateid][gRenderHQ] = value;
            
format(stringsizeof(string), "Gate RenderHQ assigned to %d"GateInfo[gateid][gRenderHQ]);
            if(
IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            
CreateGate(gateid);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
            
SaveGates();
            
format(stringsizeof(string), "%s has edited GateID %d's RenderHQ to %d."GetPlayerNameEx(playerid), gateidvalue);
            
Log("logs/gedit.log"string);
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"You are not authorized to use that command!");
        return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)