Sscanf problem[+rep]
#1

hi im having problem with Sscanf

i have this
pawn Код:
COMMAND:gotop(playerid, params[])
{
new gotopid;if(sscanf(params,"u", gotopid)) return SendClientMessage(playerid,0xFF0000FF,"Usage: "GREEN"/gotop [id]");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(gotopid,X,Y,Z);
SetPlayerPos(playerid, X+1, Y+1, Z);
return 1;
]
the problem is when theres 5 players on server then lets say i type [/gotop 4] and it will teleport me to player 0
how to fix this ?
Reply
#2

What samp version are you using
Reply
#3

Why don't you copy the /goto command from other gamemodes? Instead of waiting for an answer you could do that fast.
Reply
#4

Are you using 0.3d? Also, do it on a new line:
pawn Код:
COMMAND:gotop(playerid, params[])
{
new gotopid;
if(sscanf(params,"u", gotopid)) return SendClientMessage(playerid,0xFF0000FF,"Usage: "GREEN"/gotop [id]");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(gotopid,X,Y,Z);
SetPlayerPos(gotopid, X+1, Y+1, Z);
return 1;
}
Reply
#5

Quote:
Originally Posted by Jason_Thunde
Посмотреть сообщение
What samp version are you using
0.3c R5
Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
Why don't you copy the /goto command from other gamemodes? Instead of waiting for an answer you could do that fast.
becouse i really need this one to keep it simple and also fix some other cmds becouse they have the same problem
Reply
#6

must changed this
SetPlayerPos(gotopid, X+1, Y+1, Z);
to this
SetPlayerPos(playerid, X+1, Y+1, Z);
Reply
#7

Quote:
Originally Posted by System64
Посмотреть сообщение
must changed this
SetPlayerPos(gotopid, X+1, Y+1, Z);
to this
SetPlayerPos(playerid, X+1, Y+1, Z);
is allredy like that i just copyed it wrong from mt script sorry
Reply
#8

I just all of a sudden got this problem too, I just made a post. It was working a few days ago!
Reply
#9

pawn Код:
COMMAND:gotop(playerid, params[])
{
new gotopid;
if(sscanf(params)) return SendClientMessage(playerid,0xFF0000FF,"Usage: "GREEN"/gotop [id]");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(gotopid,X,Y,Z);
SetPlayerPos(gotopid, X+1, Y+1, Z);
return 1;
}
In mine i dont have u I just used the basic
if(sscanf(params)) this aint my code but looks the same... but mines bigger i have formats to show player i teleported to them

Never did experience what your getting yet..
Reply
#10

maybe make a loop?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)