SA-MP Forums Archive
Problem With Sscanf - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem With Sscanf (/showthread.php?tid=359317)



Problem With Sscanf - Bu11Sh0t - 13.07.2012

Hey guys, I got a problem
I have sscanf and I read in the wiki "u" parameter works with partname/id, but when i try with partname (for example /repaircar bu11) return id 0

someone know what it's wrong? or if it doesn't exist.

Sorry for bad English, i'm spanish D:


Re: Problem With Sscanf - ViniBorn - 13.07.2012

Show your command


Respuesta: Problem With Sscanf - Bu11Sh0t - 13.07.2012

pawn Код:
dcmd_repaircar(playerid, params[])
{
    new giveplayerid;
    if(PlayerInfo[playerid][Duty] < 3) return 0;
    if(sscanf(params, "u", giveplayerid))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ERROR, "ERROR: Player has not a vehicle");
        return RepairVehicle(GetPlayerVehicleID(playerid));
    }
    else
    {
        if(!IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessage(playerid, ERROR, "ERROR: Player don't have a vehicle!!");
        return RepairVehicle(GetPlayerVehicleID(giveplayerid));
    }
    return 1;
}
It works with ID's, but don't work with names


Re: Problem With Sscanf - FUNExtreme - 13.07.2012

What is your actual ingame ID and name?


Re: Problem With Sscanf - ViniBorn - 13.07.2012

pawn Код:
dcmd_repaircar(playerid, params[])
{
    if(PlayerInfo[playerid][Duty] < 3) return 0;

    new giveplayerid;
    if(sscanf(params, "r", giveplayerid))
        return SendClientMessage(playerid, ERROR, "/repaircar [Nick/ID]");

    if(!IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessage(playerid, ERROR, "ERROR: Player has not a vehicle");
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
}



Respuesta: Re: Problem With Sscanf - Bu11Sh0t - 13.07.2012

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
What is your actual ingame ID and name?
My Nickname is Bu11Sh0t, and my ID varies from 1 to 5 (id 0 is from an NPC)

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
pawn Код:
dcmd_repaircar(playerid, params[])
{
    if(PlayerInfo[playerid][Duty] < 3) return 0;

    new giveplayerid;
    if(sscanf(params, "r", giveplayerid))
        return SendClientMessage(playerid, ERROR, "/repaircar [Nick/ID]");

    if(!IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessage(playerid, ERROR, "ERROR: Player has not a vehicle");
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
}
With the 'r' return a "Server: Unknow Command" , anyone has another idea?