need help with zcmd
#1

Hi guys, i've got a RP and this script is giving me headaches.
PHP код:
CMD:estacionar(playeridparams[])
{
    if(
Info[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
    {
        new 
ownerid Info[playerid][pVehicleKeysFrom];
        if(
IsPlayerConnected(ownerid))
        {
            new 
Info[playerid][pVehicleKeys];
            if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[ownerid][d][pvId]))
            {
                if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playeridCOLOR_GREY"Tu debes ser el conductor.");
                new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
                
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
                
PlayerVehicleInfo[ownerid][d][pvHealth] = health;
                
//if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Tu vehнculo estб demasiado daсado para estacionarlo.");
                
if(Info[playerid][pLockCar] == GetPlayerVehicleID(playerid)) Info[playerid][pLockCar] = INVALID_VEHICLE_ID;
                
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], xyz);
                
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
                
SurfingCheck(GetPlayerVehicleID(playerid));
                
UpdatePlayerVehicleParkPosition(owneriddxyzanglehealth);
                
PutPlayerInVehicle(playeridGetPlayerVehicleID(playerid), 0);
                 
SetPlayerArmedWeapon(playerid0);
                new 
string[29 + (MAX_PLAYER_NAME 2)];
                
format(stringsizeof(string), "* %s ha estacionado el vehiculo de %s."GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
fVehSpeed[playerid] = 0.0;
                return 
1;
            }
        }
    }
    for(new 
MAX_PLAYERVEHICLESd++)
    {
        if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId]))
        {
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playeridCOLOR_GREY"Tu debes ser el conductor.");
            new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
            
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
            
PlayerVehicleInfo[playerid][d][pvHealth] = health;
            
//if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Tu vehiculo estб muy daсado para estacionarlo.");
            
if(Info[playerid][pLockCar] == GetPlayerVehicleID(playerid)) Info[playerid][pLockCar] = INVALID_VEHICLE_ID;
            
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], xyz);
            
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
            
SurfingCheck(GetPlayerVehicleID(playerid));
            
UpdatePlayerVehicleParkPosition(playeriddxyzanglehealth);
            
PutPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId], 0);
            
SetPlayerArmedWeapon(playerid0);
            new 
string[30 + (MAX_PLAYER_NAME 2)];
            
format(stringsizeof(string), "* %s ha estacionado su vehiculo."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
fVehSpeed[playerid] = 0.0;
            return 
1;
        }
    }
    
SendClientMessageEx(playeridCOLOR_GREY"Tu necesitas estar dentro de tu vehiculo para hacer esto.");
    return 
1;

Is there any way to make it simply just for admins??
like this.
PHP код:
zcmd(aparkplayeridparams[])
    {
        new 
Float:x,Float:y,Float:z,Float:a;
        if(
PlayerInfo[playerid][pJDS] >= 1)
        {
            new 
idcar GetPlayerVehicleID(playerid);
            
GetVehiclePos(idcarxyz);  GetVehicleZAngle(idcara);
            
CarInfo[idcar][cLocationx] = x;
                
CarInfo[idcar][cLocationy] = y;
                    
CarInfo[idcar][cLocationz] = z;
                        
CarInfo[idcar][cAngle] = a;
            
Message(playeridCOLOR_GRAD2" Nuevas coordenadas guardadas. ЎAhora el vehнculo aparecerб aqui!");
        } else 
Message(playeridCOLOR_GRAD2"ЎNo autorizado!");
        return 
1;
     } 
but ofc that one doesnt work for me, because is made for a different gm, could someone adapt that "zcmd (apark" for my gm? thank you in advance.
Reply
#2

Try adding this to your game mode

pawn Код:
#define zcmd(%1,%2,%3) \
             COMMAND:%1(%2,%3)
Reply
#3

Quote:
Originally Posted by random123
Посмотреть сообщение
Try adding this to your game mode

pawn Код:
#define zcmd(%1,%2,%3) \
             COMMAND:%1(%2,%3)
sorry im kinda new on pawn, what does that do?
Reply
#4

pawn Код:
CMD:apark(playerid, params[])
{
    new Float:x, Float:y, Float:z, Float:a;
    if(PlayerInfo[playerid][pJDS] >= 1)
    {
        new idcar = GetPlayerVehicleID(playerid):
        GetVehilePos(idcar, x, y, z); GetVehicleZAngle(idcar, a);
        CarInfo[idcar][cLocationx] = x;
        CarInfo[idcar][cLocationy] = y;
        CarInfo[idcar][cLocationz] = z;
        CarInfo[idcar][cAngle] = a;
        SendClientMessage(playerid, COLOR_GRAD2, "Nuevas coordenandas guardadas. ЎAhora el vehнculo aparecerб aqui!");
    } else { SendClientMessage(playerid, COLOR_GRAD2, "ЎNo autorizado!"); return 1; }
    return 1;
}
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
That translates the other mode's command syntax to your mode's command syntax at compile-time. Of course, that doesn't take care of all other problems such as incompatible permission systems.

The simplest way is to wrap the command in an "IsPlayerAdmin" check, as you've not provided more information on how you define admins.
Oh i forgot to add, i define as [pAdminCz] and levels from 1 to 2014.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)