HELP!! /givecar cmd problem
#1

SUP GUYS I have a small problem with my codes
I want this command to give a car /givecar [playerid] [model] [color1] [color2] [price]
only rcon can use it
all other commands are good but this one is FKed up
and set the Player owner of car
pawn Код:
CMD:givecar(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
    if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
    new model[32],position, modelid, color1, color2, price;
    if(sscanf(params, "dsddd",position ,model, color1, color2, price))
    return SendClientMessage(playerid, COLOR_RED, "USAGE: /givecar [playerid] [model] [color1] [color2] [price]");
    if(IsNumeric(model)) modelid = strval(model);
    else modelid = GetVehicleModelIDFromName(model);
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid model ID!");
    if(color1 < 0 || color2 < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid color!");
    if(price < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid price!");
    new Float:X, Float:Y, Float:Z, Float:angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, angle);
    X += floatmul(floatsin(-angle, degrees), 4.0);
    Y += floatmul(floatcos(-angle, degrees), 4.0);
    for(new i=1; i < MAX_DVEHICLES; i++)
    {
        if(!VehicleCreated[i])
        {
            new msg[128];
            VehicleCreated[i] = VEHICLE_DEALERSHIP;
            VehicleModel[i] = modelid;
            VehiclePos[i][0] = X;
            VehiclePos[i][1] = Y;
            VehiclePos[i][2] = Z;
            VehiclePos[i][3] = angle+90.0;
            VehicleColor[i][0] = color1;
            VehicleColor[i][1] = color2;
            VehicleInterior[i] = GetPlayerInterior(playerid);
            VehicleWorld[i] = GetPlayerVirtualWorld(playerid);
            VehicleValue[i] = price;
            valstr(VehicleOwner[i],position);
            VehicleNumberPlate[i] = DEFAULT_NUMBER_PLATE;
            for(new d=0; d < sizeof(VehicleTrunk[]); d++)
            {
                VehicleTrunk[i][d][0] = 0;
                VehicleTrunk[i][d][1] = 0;
            }
            for(new d=0; d < sizeof(VehicleMods[]); d++)
            {
                VehicleMods[i][d] = 0;
            }
            VehiclePaintjob[i] = 255;
            VehicleLock[i] = 0;
            VehicleAlarm[i] = 0;
            UpdateVehicle(i, 0);
            SaveVehicle(i);
            format(msg, sizeof(msg), "Added vehicle id %d to dealerid %d", i, position);
            SendClientMessage(playerid, COLOR_YELLOW, msg);
            return 1;
        }
    }
    SendClientMessage(playerid, COLOR_RED, "Can't add any more vehicles!");
    return 1;
}
Reply
#2

PHP код:
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COLOR_RED,"You are not logged in RCON!"); 
Maybe this sentence (You are not logged in RCON!) is not correct because my english is bad
I think this is what you need, or? ^^
Reply
#3

This is a problem with your first condition ?

If yes, show your function : IsAdmin
Reply
#4

well i need a fix on the command something fucked up
i want to /govcar to a player
with the fuctions they are there..
can anyone fix it for me ?
the car don't spawn close the player i give the car..
the car even don't been given
Reply
#5

Show the code of your function : IsAdmin
Reply
#6

pawn Код:
IsAdmin(playerid, level)
{
    if(IsPlayerAdmin(playerid)) return 1;
    if(CallRemoteFunction("GetPlayerCASAdmin", "d", playerid) >= level) return 1;
    return 0;
}
Reply
#7

Show the code of GetPlayerCASAdmin
Reply
#8

pawn Код:
public GetPlayerCASAdmin(playerid)
{
    return PlayerInfo[playerid][pAdmin];
}
Reply
#9

PHP код:
IsAdmin(const playerid, const level)
    return (
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= level); 
Reply
#10

dude, the whole command wont work for /givecar
it wont even spawn a car.
EDIT: By the way im using AVS system, I edited it a bit .. but still cant get that cmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)