03.03.2011, 20:56
I am making something and i need a cmd to keep a player in the vehicle when someone does a cmd.
How do i manage to do this?
Thanks in advance
How do i manage to do this?
Thanks in advance
if(strcmp(cmdtext, "/command", true) == 0)
{
new veh = GetPlayerVehicleID(playerid);
new seat = GetPlayerSeat(playerid);
PutPlayerInVehicle(playerid, veh, seat);
return 1;
}
if(strcmp(cmdtext, "/command", true) == 0)
{
new id = 0;
if(sscanf(cmdtext, "d", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "You need to enter an ID");
if(GetPlayerVehicleID(id) != GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "The player isn't in the same vehicle.");
if(id == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "Can't tie yourself up");
TogglePlayerControllable(id, false);
new string[256], idName[MAX_PLAYER_NAME], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
GetPlayerName(id, idName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You where tied up by %s.", playerName);
SendClientMessage(id, 0xFFFFFFFF, string);
format(string, sizeof(string), "You tied %s.", idName);
return SendClientMessage(playerid, 0xFFFFFFFF, string);
}
new bool : Kidnapped[MAX_PLAYERS];
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(Kidnapped[playerid] == true)
{
//return 0; If returning 0 here doesn't work.
//PutPlayerInVehicle(playerid, vehicleid, GetPlayerSeat(playerid)); Try this.
//if none of the above works, try clearing the player animation.
}
return 1;
}
I would do something like this:
pawn Код:
|