Tag mismatch with a function
#1

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.
Reply
#2

I have never heard about a Teleport();
Use SetPlayerPos(); instead.
Reply
#3

and use floatos_x, etc. because coordinates are floats. that's what causes tag mismatch
Reply
#4

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.
Reply
#5

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.
Reply
#6

check my edit. not important but just a suggestion.
Reply
#7

I don't think I need that. i want everyone in the car to teleport.
Reply
#8

well, but it wouldn'tbe nice driver-wise to get teleported without needing to ... whatever
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)