Invalid Player id Error. []
# support-forum
r
Hello, anyone know why this happens? idk why some player's id is not detected. I mean, it's like the video. It happens to some player on my server, and it'll be fixed if the player is relogin the game, i have no idea what happened https://cdn.discordapp.com/attachments/1108065542906073108/1108065543514230794/Error.mp4
g
how are your sscanfs for those commands
r
i just know that my sscanf plugin is fine, im not getting any error message at sampsvr
g
i want to know how did u make them
if it was by ID or nickname
if the params were "i" or "u" or other sscanf param
r
idk sir, what should i check first, im not making the script
g
Then why did u asked for help?
Why wouldnt the guy who is scripting asked for it?
We need to see the code for help you guys
Copy code
php
CMD:kick(playerid, params[])
{
    new targetid;
    if(sscanf(params, "u", targetid))
        return SendClientMessage(playerid,-1, "CMD: /kick [username/id]");

    Kick(targetid);
    return true;
}
r
this is one of it
Copy code
CMD:spec(playerid, params[])
{
    new userid;

    if (PlayerData[playerid][pAdmin] < 1)
        return SendErrorMessage(playerid, "You don't have permission to use this command.");

    if (sscanf(params, "u", userid))
        return SendSyntaxMessage(playerid, "/spec(tate) [playerid/name] - Type \"/unspec\" to stop spectating.");

    if (userid == INVALID_PLAYER_ID)
        return SendErrorMessage(playerid, "You have specified an invalid player.");

        
    if (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
    {
        GetPlayerPos(playerid, PlayerData[playerid][sPos][0], PlayerData[playerid][sPos][1], PlayerData[playerid][sPos][2]);

        PlayerData[playerid][pInt] = GetPlayerInterior(playerid);
        PlayerData[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
    }
    SetPlayerInterior(playerid, GetPlayerInterior(userid));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(userid));

    TogglePlayerSpectating(playerid, 1);

    if (IsPlayerInAnyVehicle(userid))
        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(userid));

    else
        PlayerSpectatePlayer(playerid, userid);

    SendServerMessage(playerid, "You are now spectating %s (ID: %d).", GetName(userid), userid);
    ShowSpectate(playerid);
    SendAdminMessage(COLOR_LIGHTRED, "AdmCmd: %s is now spectating %s", PlayerData[playerid][pUsername], GetName(userid));
    PlayerData[playerid][pSpectator] = userid;

    return 1;
}
g
the sscanf could be r too
r
i just trying to fix this free gamemode on yt, for my server
g
do a printf before the userid invalid playerid
and see what it returns, probably the sscanf bugged
and btw "u" could be for bots aswell, so the ID 7 could be an actor/bot and not a player, so thats why could be invalid
r
how to
my bad, sir. i just new on scripting
g
all good
u should learn the basics, but answering your question u need to do printf("%d", userid); or printf(userid); idk if its transformed in string or no, so put both
above that line of ``if(userid == invalid...)``
r
then, how to see the returns
g
the printf will return it in samp-server.exe
to see it better u could change the printf to:
Copy code
c
printf("User id in int: %d", userid);
printf("User id in string: %s", userid);
r
allright sir, im trying it ingame, to see the return
idk where to start
g
Adventure yourself, do basic things like a login screen and shit
There's lots of tutorials in the internet
Don't forget to compile the .pwn and restart the server
r
yessir, already doing it
ah, one thing that always showed up

https://cdn.discordapp.com/attachments/1108065542906073108/1108071831879045160/image.png

that directory name is invalid
g
to be honest with you idk whats that
never had this error, should be windows 8 bug
or your visual c++ redist arent updated
m
Well
I have the some Probelm
g
i mean this topic already said like 10 problems
what is yours
m
Same
When i want to teleport to id doesn't work
g
code error then
post in #231799180127895553 the code and the question
m
@rapid-needle-72108 did you solve it ?
r
im reinstalling the include, no invalid id shown until now, i think it's worked
m
What did you do
r
reinstall the sscanf
m
In the pawno or include
g
good
as its a old gamemode could be the sscanf version
m
How to do that
g
downloading and installing ??
m
From where
g
sscanf ?? ...
do u even know the basics of pawn man
m
ye
g
dont look like so
m
Im new
r
oh no
the problem showed again
m
r
keep getting the invalid id
m
Did you add the discord connecter ?
r
so, if the player's ping dropped, player will timestuck, then the invalid id showed
the printf didnt showing anything
m
Then how to fix thath
Me too
g
What are u talking about
This has nothing to do with it
m
I though the problème because of discord connecter
Since i add that thr probleme start
g
So the userid in the sscanf didnt go through, weird tho
which command are u trying it?
bro i'll be real, if u dont know that much, dont try to help when u dont know what u are talking about
r
spec, that i put the printf
g
the problem was invalid id and its about sscanf, no one said nothing bout discord connector
how its your command? can u send it please?
r
a minute
i can sed the full script if u want xd
g
not necessary
send the command u are having trouble with
r
Copy code
CMD:kick(playerid, params[])
{
    static
        userid,
        reason[128];

    if (PlayerData[playerid][pAdmin] < 1)
        return SendErrorMessage(playerid, "You don't have permission to use this command.");

    if (sscanf(params, "us[128]", userid, reason))
        return SendSyntaxMessage(playerid, "/kick [playerid/name] [reason]");

    // Disini
    
    printf("User id in int: %d", userid);
    printf("User id in string: %s", userid);
    if (userid == INVALID_PLAYER_ID)
        return SendErrorMessage(playerid, "You have specified an invalid player.");

    if (PlayerData[userid][pAdmin] > PlayerData[playerid][pAdmin])
        return SendErrorMessage(playerid, "The specified player has higher authority.");

    Log_Write("Logs/kick_log.txt", "[%s] %s Has kicking %s reason %s", ReturnDate(), PlayerData[playerid][pUsername], GetName(userid), reason);
    SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s has been kicked by %s for: %s.", GetName(userid), PlayerData[playerid][pUsername], reason);
    SavePlayerData(userid);
    KickEx(userid);
    return 1;
}
i mean, kick
g
its weird man, looking at it, its right wtf
in the console it prints like Userid in int: Userid in string:
r
[21:41:32] User id in int: 65535 [21:41:32] User id in string: ÿa [21:41:32] [ZCMD] Omeri_Foalema: /kick 3 a
g
Hm
r
i have no idea
g
try using new instead of static, wont change that much but at least try it lol
r
okay, but i need to restart the server, still have some player ig
i still have 3 ysi warning on my gm, is it relate with the invalid id?
g
i mean if its a test server its ok
but dont release to the public if it cant even kick someone lmao
no
i'll send my command
Copy code
php
@cmd() kick(playerid, params[], help)
{
    if(User[playerid][playerAdminLevel] < 1) 
        return SendClientMessage(playerid,-1, NEED_ADMIN_LEVEL);

    new reason[64], targetid;
    if(sscanf(params, "us[64]", targetid, reason))
        return SendClientMessage(playerid,-1, KICK_HELP);

    if(!IsPlayerConnected(targetid)) 
        return SendClientMessage(playerid,-1, IS_NOT_CONNECTED);
    
    if(User[targetid][playerAdminLevel] >= User[playerid][playerAdminLevel]) 
        return SendClientMessage(playerid, -1, SUPERIOR_RIGHTS);

    va_SendClientMessageToAll(-1, KICK_REASON, User[playerid][userName], User[targetid][userName], targetid, reason);

    KickEx(targetid, 300);

    return true;
}
r
I can kick ID 0, but i cant kick id 3

https://cdn.discordapp.com/attachments/1108065542906073108/1108609975351246888/sa-mp-000.png

The invalid player is id 3

https://cdn.discordapp.com/attachments/1108065542906073108/1108610064224366642/sa-mp-001.png

[11:16:33] [ZCMD] Omeri_Foalema: /kick 0 test, maaf bang lagi tes script [11:16:35] [part] Katagiri_Tetsuo has left the server (0:2) printf for id 3 [11:16:37] User id in int: 65535 [11:16:37] User id in string: ÿ [11:16:37] [ZCMD] Omeri_Foalema: /kick 3 a
already reinstall the sscanf, changing the static, to new
all that i know is, if player have a connection issue, then he will stucked on wrong world id
everything's dissapear, except the original gtasa map
then if admin want to set the player world id back to normal, it cant
the command is worked, but nothing happen to the player
f
Did you updated sscanf plugin too? Download the same version and update both (include e plugin)
g
yeah @rapid-needle-72108 , did u reinstall the same version or the newest
r
updated the sscanf plugin to the latest version, still same
and what's e plugin?
g
sscanf is a plugin my king
it comes with .inc and a .dll
r
yess ikkk
i mean, "e plugin"
this
g
oh
i think hes a portuguese speaker
"e" in ptbr/pt-pt means AND like -> include AND plugin
damn
the worst part is i'm without my computer rn, so i cant help yuo =/
r
😦
i have no idea with this
😭
g
make the same question in #231799180127895553 explicitly, put the image, the code (in text) and the printf's in the console too
maybe they can help you more than i didnt
f
No, I’m not. I wanted to write “and”, my bad. @rapid-needle-72108 Where you collocated the plugin? In “components” or “plugins” folder?
r
pluginssss
f
Are you on open.mp or samp?
r
samp
f
Have you this file? Let me see your server.cfg

https://cdn.discordapp.com/attachments/1108065542906073108/1108728564943163422/Immagine_2023-05-18_141024.png

I'm sure you're missing some file
r
yes i have amxsscanf
echo Executing Server Config... lanmode 1 rcon_password password maxplayers 50 port 7777 hostname Astro Roleplay gamemode0 astro filterscripts buttons maploader discord AT plugins streamer sscanf mysql samp_bcrypt pawn-memory discord-connector pawnraknet announce 0 query 1 chatlogging 1 language Indonesia weburl astro-rp.com onfoot_rate 40 incar_rate 40 weapon_rate 40 stream_distance 2000.0 stream_rate 2000 maxnpc 11 logtimeformat [%H:%M:%S] sleep 1 mtu 1400 discord_bot_token connectiontime 2000
f
wtf
m
r
what
m
@rapid-needle-72108
Can i ask you about pawnraknet ?
@rapid-needle-72108
r
i know nothing, bro
m
I have the file but i dont know how to put it
r
ah
better read the installation guide
m
Where
r
pawnraknet in github
m
Okay
g
in the github?
b
Strange error
Have you tried using "r" instead of "u"? @rapid-needle-72108
And also
Try using new instead of static
r
already using new
2 Views