Adding vehicles - 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: Adding vehicles (
/showthread.php?tid=426217)
Adding vehicles -
Fernado Samuel - 28.03.2013
Removed
Re: Adding vehicles -
LeeXian99 - 28.03.2013
You can use AddStaticVehicle or AddStaticVehicleEx on OnGameModeInit.
Re: Adding vehicles -
Jeffry - 28.03.2013
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == ServerVehicle[0])
{
SendClientMessage(playerid, -1, "Welcome to Server Vehicle 0");
}
return 1;
}
Re: Adding vehicles -
Fernado Samuel - 28.03.2013
Removed
Re: Adding vehicles -
Jeffry - 28.03.2013
Quote:
Originally Posted by Fernado Samuel
By adding this line, it will show the message only when i enter the vehicle id 0 know?
|
Yup. You want the message to appear for all of them?
Re: Adding vehicles -
Fernado Samuel - 28.03.2013
Removed
Re: Adding vehicles -
Fernado Samuel - 28.03.2013
dumb!
Re: Adding vehicles -
Jeffry - 28.03.2013
1.) It's bump (bring up my post), not dumb (~stupid).
2.) Do not bump within a few hours, please.
3.) Code below:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
for(new i=0; i<sizeof(ServerVehicle); i++)
{
if(vehicleid == ServerVehicle[i])
{
SendClientMessage(playerid, -1, "Welcome to a Server Vehicle!");
}
}
return 1;
}
Re: Adding vehicles -
CJay9209 - 28.03.2013
better to use this code. OnPlayerEnterVehicle gets called too soon to be of much use to anyone in this application.
pawn Код:
public OnPlayerStateChange(playerid, newtstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER) {
new vehicleid = GetPlayerVehicleID(playerid),string[MAX_STRING];
for(new i=0; i<sizeof(ServerVehicle); i++) {
if(vehicleid == ServerVehicle[i]) {
format(string,sizeof(string),"This is a Server Vehicle. \n-= Server ID: %d <> Vehicle ID: %d =-", i, vehicleid);
GameTextForPlayer(playerid, string, 3000, 1);
return 1;
}
}
}
return 0;
}
this will be called when the player sits in the car and not when you hit the entry button. basically its a bit safer and avoids having problems later on down the line. The code above woill also print out which server array id the vehicle has and which vehicleid the vehicle has.
Re: Adding vehicles -
Fernado Samuel - 28.03.2013
Removed