cars... - 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: cars... (
/showthread.php?tid=172529)
cars... -
[Lsrcr]Rafa - 30.08.2010
hello how i can make when player will enter in a vehicle to writing "This vehicle is just for Admins" and auto eject....
![Huh?](images/smilies/confused.gif)
![Huh?](images/smilies/confused.gif)
Re: cars... -
Ironboy500[TW] - 30.08.2010
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerAdmin(playerid) == 0)
{
SendClientMessage(playerid, RED, "Error: This Vehicle Is Only For Admins.");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
Re: cars... -
CyNiC - 30.08.2010
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VEHICLEID_WHO_YOU_WANT)
{
SendClientMessage(playerid, 0xFFFFFFFF, "This Vehicle is restrict for admins, get out!");
RemovePlayerFromVehicle(playerid);
return 1;
}
return 1
}
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
Re: cars... -
Jay. - 30.08.2010
Quote:
Originally Posted by Ironboy500[TW]
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerAdmin(playerid) == 0)
{
SendClientMessage(playerid, RED, "Error: This Vehicle Is Only For Admins.");
SetPlayerHealth(playerid, 0);
}
return 1;
}
|
Ehh..
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerAdmin(playerid) == 0)
{
SendClientMessage(playerid, RED, "Error: This Vehicle Is Only For Admins.");
SetPlayerHealth(playerid, 0);
}
else
{
SendClientMessage(playerid,RED,"Welcome admin!");
}
Re: cars... -
Jay. - 30.08.2010
Quote:
Originally Posted by cynic
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VEHICLEID_WHO_YOU_WANT) { SendClientMessage(playerid, 0xFFFFFFFF, "This Vehicle is restrict for admins, get out!"); RemovePlayerFromVehicle(playerid); return 1; }
return 1 }
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
|
You only need to return 1 once.
Re: cars... -
CyNiC - 30.08.2010
Quote:
Originally Posted by [BADBOY]
You only need to return 1 once.
|
Not, the sintax "return 1" is equal to return true, so is good use return 1 to finalize the callback when not is necessary verify more nothing in the callback.
The last "return 1" not have importance, is only to give return to the callback.
Re: cars... -
FireCat - 30.08.2010
i would go more for
Quote:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerAdmin(playerid) == 0)
{
SendClientMessage(playerid, RED, "Error: This Vehicle Is Only For Admins.");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
|
change
Quote:
if(IsPlayerAdmin(playerid) == 0)
|
to your admin level
_______________________
1-3$ fix warnings 1-5$fix errors
6-15$ make gamemodes(not roleplay) 3-10$ make filterscripts-scriptfiles
Dont ASK! me RolePlay questions
www.mefreeroam.tk
Re: cars... -
[Lsrcr]Rafa - 30.08.2010
ehm thanks guys but i dont want just on that car to get out the player i want just on that vehicle what i want and where to stay.
sorry i cant explain good but i think u understand guys ? :S
Re: cars... -
Ironboy500[TW] - 30.08.2010
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VEHICLEID_WHO_YOU_WANT)
{
SendClientMessage(playerid, 0xFFFFFFFF, "This Vehicle is restrict for admins, get out!");
RemovePlayerFromVehicle(playerid);
return 1;
}
return 1
}
Replace VEHICLEID_WHO_YOU_WANT with vehicle id you want message to show up for.
Re: cars... -
CAR - 30.08.2010
Quote:
Originally Posted by Ironboy500[TW]
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VEHICLEID_WHO_YOU_WANT)
{
SendClientMessage(playerid, 0xFFFFFFFF, "This Vehicle is restrict for admins, get out!");
RemovePlayerFromVehicle(playerid);
return 1;
}
return 1
}
Replace VEHICLEID_WHO_YOU_WANT with vehicle id you want message to show up for.
|
You're so close, but when you're admin, you can't enter:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VEHICLEID_WHO_YOU_WANT)
{
if(IsPlayerAdmin(playerid)) return 1;
SendClientMessage(playerid, 0xFFFFFFFF, "This Vehicle is restrict for admins, get out!");
RemovePlayerFromVehicle(playerid);
}
return 1
}