need a command to exit a car
#1

like /exit need it because i most of the time stuck in a car who can help me?
Reply
#2

make a /exit command and use RemovePlayerFromVehicle
https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle
should work.
Reply
#3

pawn Код:
else if (streq(cmd,"/exit")) {
      new text[256];
      RemovePlayerFromVehicle(playerid);
      format(text,sizeof text,"You exited from your vehicle!");
      SendClientMessagel(playerid,COLOR_COLOR);
      return 1;
      }
Reply
#4

And because you get frozen, TogglePlayerControllable may be helpful
Reply
#5

Код:
if(strcmp(cmdtext, "/exit", true) == 0)
{
RemovePlayerFromVehicle(playerid);
}
this shld work

Reply
#6

thank yo al i love you guys

topic closed :P
Reply
#7

Quote:
Originally Posted by Jakku
pawn Код:
else if (streq(cmd,"/exit")) {
      new text[256];
      RemovePlayerFromVehicle(playerid);
      format(text,sizeof text,"You exited from your vehicle!");
      SendClientMessagel(playerid,COLOR_COLOR);
      return 1;
      }
Fail, why make a variable with 256 cells?! format is useless too...
Do you even know the player has defined cmd?
pawn Код:
if(!strcmp(cmdtext,"/exit",true)){
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA, "You aren't in a vehicle!");
  RemovePlayerFromVehicle(playerid);
  TogglePlayerControllable(playerid, true); // if frozen
  return SendClientMessage(playerid, 0xFFFFFFAA, "Your Text");
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)