[in game error] sscanf problems
#1

Hi whenever i use my commands is says that i am typing it wrong? below here you can see the commands that are not working!


pawn Код:
CMD:goto(playerid, params[])
{
    new targetid;
    if(sscanf(params, "u", targetid)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");
    else if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(targetid, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    }
    return 1;
}
CMD:gethere(playerid,params[])
{
    new targetid, Float:x, Float:y, Float:z;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gethere [id]");
    if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");
    SetPlayerPos(targetid, x+1, y+1, z);
    return 1;
}
CMD:afix(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
    }
    else SendClientMessage(playerid, COLOR_RED, "You must be an admin to use this command");
    return 1;
}
CMD:setfaction(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] <= 5)
    {
    new otherplayerid;
    new faction;
    new pName[MAX_PLAYER_NAME], gName[MAX_PLAYER_NAME];
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "u", otherplayerid, faction)) return SendClientMessage(playerid, COLOR_RED, "Use /setfaction [playerid/name] [faction number 1 - 11]");
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    GetPlayerName(otherplayerid, gName, MAX_PLAYER_NAME);
    SendClientMessage(otherplayerid, COLOR_GREEN, " ** Admin %s has set your faction to %s", pName, faction);
    SendClientMessage(playerid, COLOR_GREEN, " ** You have set player %s faction to %s", gName, faction);
    PlayerInfo[otherplayerid][gTeam] = faction;
    }
    else SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 5 admin to do that!");
    return 1;
}
CMD:givemoney(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new otherplayerid;
        new money;
        if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
        if(sscanf(params, "u", otherplayerid, money)) return SendClientMessage(playerid, COLOR_RED, "Use /givemoney [playerid/name] [amount of money]");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have given that player some money");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have been given money from a admin!");
        GivePlayerMoney(otherplayerid, money);
    }
    else return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 2 admin to do that!");
    return 1;

}
CMD:sethp(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new otherplayerid;
        new health;
        if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
        if(sscanf(params, "u", otherplayerid, health)) return SendClientMessage(playerid, COLOR_RED, "Use /sethp [playerid/name] [amount of health]");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have given that player some health");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have been healed by a admin!");
        SetPlayerHealth(otherplayerid, health);
    }
    else return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 1 admin to do that!");
    return 1;
}
CMD:setarmour(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new otherplayerid;
        new armour;
        if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
        if(sscanf(params, "u", otherplayerid, armour)) return SendClientMessage(playerid, COLOR_RED, "Use /setarmour [playerid/name] [amount of armour]");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have given that player some armour");
        SendClientMessage(playerid, COLOR_GREEN, " ** You have been given armour by a admin!");
        SetPlayerArmour(otherplayerid, armour);
    }
    else return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 1 admin to do that!");
    return 1;
}
Reply


Messages In This Thread
[in game error] sscanf problems - by NewerthRoleplay - 02.05.2012, 16:49
Re: [in game error] sscanf problems - by ViniBorn - 02.05.2012, 17:31
Re: [in game error] sscanf problems - by NewerthRoleplay - 02.05.2012, 19:08
Re: [in game error] sscanf problems - by ViniBorn - 02.05.2012, 19:28
Re: [in game error] sscanf problems - by NewerthRoleplay - 02.05.2012, 19:44
Re: [in game error] sscanf problems - by ViniBorn - 02.05.2012, 19:49
Re: [in game error] sscanf problems - by NewerthRoleplay - 02.05.2012, 19:49
Re: [in game error] sscanf problems - by Oscii - 02.05.2012, 20:48
Re: [in game error] sscanf problems - by NewerthRoleplay - 02.05.2012, 20:52
Re: [in game error] sscanf problems - by Oscii - 02.05.2012, 20:55

Forum Jump:


Users browsing this thread: 4 Guest(s)