[in game error] sscanf problems
#2

Try this
pawn Код:
CMD:goto(playerid, params[])
{
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");
    if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");

    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;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gethere [id]");
   
    new Float:x, Float:y, Float:z;
    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) return SendClientMessage(playerid, COLOR_RED, "You must be an admin to use this command");
    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!");
    return 1;
}
CMD:setfaction(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 5)
        return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 5 admin to do that!");

    new otherplayerid, faction;
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "ud", otherplayerid, faction)) return SendClientMessage(playerid, COLOR_RED, "Use /setfaction [playerid/name] [faction number 1 - 11]");

    new pName[MAX_PLAYER_NAME], gName[MAX_PLAYER_NAME];
    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;
    return 1;
}
CMD:givemoney(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2)
        return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 2 admin to do that!");

    new otherplayerid, money;
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "ud", 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);
    return 1;
}

CMD:sethp(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 1 admin to do that!");

    new otherplayerid, Float:health;
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "uf", 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);
    return 1;
}
CMD:setarmour(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 1 admin to do that!");

    new otherplayerid, Float:armour;
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "uf", 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);
    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: 1 Guest(s)