19.06.2013, 20:05
(
Last edited by SilverKiller; 20/06/2013 at 03:13 PM.
Reason: Hmm i wanted to put my tutorial back..
)
Hello,
I saw alot of people experiencing this issue
So, i made a tutorial for this (Sorry if it is not explained fully as it is my first tutorial)
First, if you have something like this in your script and you are using sscanf 2:
And then you check if the id is connected like this :
It will return Invalid Player ID even if the id is connected.
Now i will tell you how to fix this.
Change the u (Username) in the sscanf param line to d (Integer) (That means we will change the u (Username) param to d (Integer). Example :
Notes:pawn Code:
new idvariable, something[60]; // Defines new idvariable for the id and something for the string (text) and something's size is 60.
if(sscanf(params, "us[60]", idvariable, something)) // This checks if the player didn't type the command fully, like the player typed /command 0 it will show him this cause he didn't type the text after 0 (id).
pawn Code:
if(!IsPlayerConnected(idvariable)) return SendClientMessage(playerid, -1, "Invalid Player ID"); // If the id is not connected it will return him a message in the chat with the white color (-1) Invalid Player ID.
Now i will tell you how to fix this.
Change the u (Username) in the sscanf param line to d (Integer) (That means we will change the u (Username) param to d (Integer). Example :
pawn Code:
if(sscanf(params, "ds[60]", idvariable, something))
d = Integer
i = Integer
c = Character
u = User ID or name
s = String
h = Hex number
x = Hex number
f = Float
z = Optional string
When you fix this problem, you will be able to only use IDs for players, not names.
This is my first tutorial, i'm sorry if i didn't explain it fully!
Thank you for reading this.