SA-MP Forums Archive
sscanf problems - 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: sscanf problems (/showthread.php?tid=392560)



sscanf problems - HardBoy - 14.11.2012

hey guyss...

the problem is:

when i do /i it shows me the textdraw but it says unkown command (while im on foot)
but if im in vehicle the textdraw won't responce and nothing will appear and it will say uknown command,

pawn Код:
new ID;
    if(sscanf(params, "ui", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");
    else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, ROJO, "Player is not connected!");
    else
    {
pawn Код:
TextDrawShowForPlayer(playerid,PlayerInfo2);
        TextDrawShowForPlayer(playerid,PlayerLocationetc);
        new carid = GetPlayerVehicleID(ID);
        new zone[MAX_ZONE_NAME], string[100], name[50];
        GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
        GetPlayerName(ID,name,MAX_PLAYER_NAME+1);
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(!IsPlayerInAnyVehicle(ID)&& civilianteam[playerid]==1 || ciateam[playerid]==1)
        {
            format(string, 256, "~n~          ~b~~h~%s (%d)~n~~n~~g~Location: ~w~%s ~n~~g~Feet: ~w~%d ~n~~g~Wanted Level: ~w~%d ~n~~g~Vehicle: ~w~NONE ~n~~g~Team: ~w~Civilian ~n~~g~Speed: ~w~0", name, ID, zone, GetPlayerDistanceFromPoint(ID, X, Y, Z), GetPlayerWantedLevel(ID));
            GameTextForPlayer(playerid,"~n~    ~w~Press ~r~~h~LMB ~w~For Hide The~n~~w~Player Info!",5000,3);
        }
        else if(IsPlayerInAnyVehicle(ID)&& civilianteam[playerid]==1 || ciateam[playerid]==1)
        {
            format(string, 256, "~n~          ~b~~h~%s (%d)~n~~n~~g~Location: ~w~%s ~n~~g~Feet: ~w~%d ~n~~g~Wanted Level: ~w~%d ~n~~g~Vehicle: ~w~%s ~n~~g~Team: ~w~Civilian ~n~~g~Speed: ~w~%d", name, ID, zone, GetPlayerDistanceFromPoint(ID, X, Y, Z), GetPlayerWantedLevel(ID),VehicleNames[GetVehicleModel(carid)-400], GetPlayerSpeed(ID));
            GameTextForPlayer(playerid,"~n~    ~w~Press ~r~~h~LMB ~w~To Hide The~n~~w~Player Info!",5000,3);
        }
pawn Код:
TextDrawSetString(PlayerLocationetc,string);
im sure 100% problem is in the sscanf(params,ui)
because when i change it something get fixed and something get bugged and sometimes they both get bugged

pls help


Re: sscanf problems - HardBoy - 14.11.2012

im using sscanf2.6

omg sorry for making 2 posts in one time instead of edit

i thougt my self editing then it made a reply... sorry admins


Re: sscanf problems - blackbhuta - 14.11.2012

Код:
new ID;
    if(sscanf(params, "i", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");
    else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, ROJO, "Player is not connected!");
    else
    {
delete "u" on if(sscanf(params, "ui", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");


Re: sscanf problems - HardBoy - 15.11.2012

Quote:
Originally Posted by blackbhuta
Посмотреть сообщение
Код:
new ID;
    if(sscanf(params, "i", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");
    else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, ROJO, "Player is not connected!");
    else
    {
delete "u" on if(sscanf(params, "ui", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");
it's now working while im on feet and sending me unkown command but working, but when im in vehicle it send unkown command and not working

pls i near good ppl with sscanf im rddy to do anything


Re: sscanf problems - HardBoy - 15.11.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to return 1.
there is return 1;
but i didn't give the whole code, because these codes are in all the function used Copy-Paste for different teams

there is return 1;

pls i need help


Re: sscanf problems - iggy1 - 15.11.2012

Post the full command. It's kind of silly asking for help with code but then not showing all of it. Doesn't seem like it's sscanf because if it fails it will send you a message, and if it doesn't fail, execution will continue.

Also change the sscanf line to this.

pawn Код:
if(sscanf(params, "u", ID)) SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID/NAME]");



Re: sscanf problems - HardBoy - 15.11.2012

................................Cannot show code sorry...............................


Re: sscanf problems - Edvin - 15.11.2012

****** referred to put return here:
Quote:

if(sscanf(params, "uif", ID)) return SendClientMessage(playerid, BLANCO, "USAGE: /info(/i) [ID]");
else if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, ROJO, "Player is not connected!");




Re: sscanf problems - HardBoy - 15.11.2012

Quote:
Originally Posted by Edvin
Посмотреть сообщение
****** referred to put return here:
stell not working, and its crashing when i do /i (id) while im in car and on-foot

but the textdraw is showing when ID is on-foot but the server will stell crash

pls pls help help?


Re: sscanf problems - HardBoy - 15.11.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
Then you need to add print statements between every line to see which one is causing the crash.
the whole game is crashed i mean the console is closing auto when i do it, so how could i see?