When I use /slap on a player if they are driving, the speedo still displays.. - 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)
+--- Thread: When I use /slap on a player if they are driving, the speedo still displays.. (
/showthread.php?tid=360349)
When I use /slap on a player if they are driving, the speedo still displays.. -
Dokins - 17.07.2012
Title says all, It should hide the speedo, right? If they are not the driver. Here's the code:
* Dokins slaps command. around a bit with a large trout.
pawn Код:
CMD:slap(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new giveplayerid;
if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /slap [player id or name]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
new Float: x, Float: y, Float: z;
GetPlayerPos(giveplayerid, x, y, z);
SetPlayerPos(giveplayerid, x, y, z+5);
new string[128];
format(string, sizeof(string), "Admin %s slapped you.", GetNameEx(playerid));
SendClientMessage(giveplayerid, COLOUR_LIGHTBLUE, string);
format(string, sizeof(string), "You slapped %s.", GetNameEx(giveplayerid));
SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
return 1;
}
Player State Check.
pawn Код:
if(GetPlayerState(playerid)!= PLAYER_STATE_DRIVER)
{
VehicleSQLID[vehicleid] = MySQL_GetValue(VehicleSQLID[vehicleid], "id", "vehicles");
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehFuel", VehFuel[vehicleid], "vehicles");
if(EngineStartStatus[vehicleid] == 0)
{
KillTimer(SpeedoSysTimer[playerid]);
KillTimer(FuelSysTimer[playerid]);
}
TextDrawDestroy(enginestring);
TextDrawHideForPlayer(playerid, enginestring);
TextDrawHideForPlayer(playerid,speed[playerid]);
TextDrawHideForPlayer(playerid,fuel[playerid]);
}
Re: When I use /slap on a player if they are driving, the speedo still displays.. -
Vince - 17.07.2012
Where do you have that second piece of code? I am not sure if OnPlayerExitVehicle is called when a player gets teleported out, but OnPlayerStateChange should probably work.
Re: When I use /slap on a player if they are driving, the speedo still displays.. -
Dokins - 17.07.2012
Yeah, it's under OnPlayerStateChange.
Re: When I use /slap on a player if they are driving, the speedo still displays.. -
Dokins - 17.07.2012
Do you have any ideas?