Sscanf ..
#2

i is for integers use %s and create 1 string variable to save the input from sscanf

pawn Код:
CMD:vipcar(playerid, params[])
{
    if(PlayerInfo[playerid][pVIP] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "[VIP] - Only VIPS can use this command!");

    new vehicle[64];
    new string[84], car;
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x,y,z);
    new Float:Angle;
    GetPlayerFacingAngle(playerid, Angle);
    if(sscanf(params, "s[64]", vehicle)) return SendClientMessage(playerid,0xFFFFFFFF,"Usage: /vipcar name");
    if(strcmp(vehicle,"infernus",true,8) == 0) // If Vehicle == infernus, true means ignore CaSeSeNsItIvE
    {
        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(strcmp(vehicle,"bullet",true,6) == 0) // the 6 is in this case is because bullet is 6 chars
    {
        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(strcmp(vehicle,"sultan",true,6) == 0)
    {
        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(strcmp(vehicle,"caddy",true,5) == 0)
    {
        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);
    }
    else
    {
        SendClientMessage(playerid,0xFFFFFFFF,"[VIP] Invalid Vip Car Type");
    }
    return 1;
}
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)