Sscanf ..
#1

So, eh, I created the command /vipcar, and it should allow you to choose one of the 4 cars.
For an example:
/vipcar Caddy
It would spawn you, and put you in a Caddy.

But, it doesn't let me select it, it just puts me in the Infernus.

Here's the code

pawn Код:
CMD:vipcar(playerid, params[]) {
    new string[84], car;
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x,y,z);
    new Float:Angle;
    GetPlayerFacingAngle(playerid, Angle);
    if(PlayerInfo[playerid][pVIP] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "[VIP] - Only VIPS can use this command!");
    new infernus, bullet, caddy, sultan;
    if(sscanf(params, "i", infernus))
    {
        car = CreateVehicle(411, x,y,z, Angle, random(128), random(128), 180);
        PutPlayerInVehicle(playerid, car, 0);
        new sender[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sender, sizeof(sender));
        format(string, sizeof(string), "[ADMIN] - VIP %s[%d] has used VIPCAR", sender, playerid);
        format(string, sizeof(string), "[VIP] - %s[%d] has used VIPCAR", sender, playerid);
        SendMessageToVIPS(string);
    }
    else if(sscanf(params, "i", bullet))
    {
        car = CreateVehicle(541, x,y,z, Angle, random(128), random(128), 180);
        PutPlayerInVehicle(playerid, car, 0);
        new sender[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sender, sizeof(sender));
        format(string, sizeof(string), "[ADMIN] - VIP %s[%d] has used VIPCAR", sender, playerid);
        format(string, sizeof(string), "[VIP] - %s[%d] has used VIPCAR", sender, playerid);
        SendMessageToVIPS(string);
    }
    else if(sscanf(params, "i", sultan))
    {
        car = CreateVehicle(560, x,y,z, Angle, random(128), random(128), 180);
        PutPlayerInVehicle(playerid, car, 0);
        new sender[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sender, sizeof(sender));
        format(string, sizeof(string), "[ADMIN] - VIP %s[%d] has used VIPCAR", sender, playerid);
        format(string, sizeof(string), "[VIP] - %s[%d] has used VIPCAR", sender, playerid);
        SendMessageToVIPS(string);
    }
    else if(sscanf(params, "i", caddy))
    {
        car = CreateVehicle(457, x,y,z, Angle, random(128), random(128), 180);
        PutPlayerInVehicle(playerid, car, 0);
        new sender[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sender, sizeof(sender));
        format(string, sizeof(string), "[ADMIN] - VIP %s[%d] has used VIPCAR", sender, playerid);
        format(string, sizeof(string), "[VIP] - %s[%d] has used VIPCAR", sender, playerid);
        SendMessageToVIPS(string);
    }
    return 1;
}
I suppose that I've done something wrong at the "else if(sscanf.....))", but what?
Maybe the "i"?


EDIT:
If somebody fixes this, could you explain me what did you change?
Because i would need to fix /vipbike, /vipboat and /vipheli too then.
Reply


Messages In This Thread
Sscanf .. - by Kyance - 25.01.2014, 18:47
AW: Sscanf .. - by xerox8521 - 25.01.2014, 20:41
Re: Sscanf .. - by Ranshand - 25.01.2014, 21:34
Re: Sscanf .. - by Kyance - 26.01.2014, 06:58

Forum Jump:


Users browsing this thread: 1 Guest(s)