Tag mismatch with a function - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Tag mismatch with a function (
/showthread.php?tid=84567)
Tag mismatch with a function -
Gerinych - 01.07.2009
OK, I'm trying to work out a simple teleport script, but I get a tag mismatch error. Here's the important chunk of the code:
Код:
Teleport(id_player, coord_x, coord_y, coord_z)
{
if(IsPlayerInAnyVehicle(id_player) == 1)
{
SetVehiclePos(GetPlayerVehicleID(id_player), coord_x, coord_y, coord_z);
}
else
{
SetPlayerPos(id_player, coord_x, coord_y, coord_z);
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/chilliad", cmdtext, true, 10) == 0)
{
GameTextForPlayer(playerid,"Welcome to Chilliad",4000,3);
Teleport(playerid, -2372.1711, -1601.2511, 498.4596); //The thing gives 3 tag mismatches on this line.
return 1;
}
}
I just started to program on PAWNO, so I can't do much. I also looked around this forum and many people got tag mismatch error, but not the way I got it.
Re: Tag mismatch with a function -
refshal - 01.07.2009
I have never heard about a Teleport();
Use SetPlayerPos(); instead.
Re: Tag mismatch with a function -
Ignas1337 - 01.07.2009
and use float

os_x, etc. because coordinates are floats. that's what causes tag mismatch
Re: Tag mismatch with a function -
kaisersouse - 01.07.2009
Quote:
Originally Posted by cοοp
I have never heard about a Teleport();
|
Custom function that uses SetPlayerPos or SetVehiclePos depending if player is in a vehicle.
OP change
Код:
Teleport(id_player, coord_x, coord_y, coord_z)
to
Код:
Teleport(id_player, Float:coord_x, Float:coord_y, Float:coord_z)
EDIT: also might want to check if GetPlayerState == PLAYER_STATE_DRIVER instead of using IsPlayerInAnyVehicle. It will be faster, and reduce the chances that someone will hop into an occupied vehicle as a passenger and start teleporting the vehicle (and its driver) all over the place. Just something to consider. It will cut down on griefing.
Re: Tag mismatch with a function -
Gerinych - 01.07.2009
Quote:
Originally Posted by kaisersouse
Quote:
Originally Posted by cοοp
I have never heard about a Teleport();
|
Custom function that uses SetPlayerPos or SetVehiclePos depending if player is in a vehicle.
OP change
Код:
Teleport(id_player, coord_x, coord_y, coord_z)
to
Код:
Teleport(id_player, Float:coord_x, Float:coord_y, Float:coord_z)
|
Hey, it works! Thanks.
Re: Tag mismatch with a function -
kaisersouse - 01.07.2009
check my edit. not important but just a suggestion.
Re: Tag mismatch with a function -
Gerinych - 01.07.2009
I don't think I need that. i want everyone in the car to teleport.
Re: Tag mismatch with a function -
Ignas1337 - 01.07.2009
well, but it wouldn'tbe nice driver-wise to get teleported without needing to

... whatever