Vehicle help. - 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: Vehicle help. (
/showthread.php?tid=274363)
Vehicle help. -
iGetty - 05.08.2011
How could I check if someone is in a specific vehicle?
Like, how could I put on this command:
pawn Код:
command(sweep, playerid, params[])
{
if(//Here get the vehicle ID, of 574.)
{
Sweepcp[playerid] = 1;
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.2069, 3.0);
SendClientMessage(playerid, 0xFFFFFFFF, "You have started to sweep the streets, Please follow the checkpoints.");
}
else
{
SendClientMessage(playerid, WHITE, "You must be in a sweeper to sweep the streets.");
}
return 1;
}
Thanks for all the help, and the people who help will get +1 reputation.
Re: Vehicle help. -
WoodPecker - 05.08.2011
pawn Код:
command(sweep, playerid, params[])
{
new Model = GetVehicleModel(vehicleid);
if(Model == 574)
{
Sweepcp[playerid] = 1;
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.2069, 3.0);
SendClientMessage(playerid, 0xFFFFFFFF, "You have started to sweep the streets, Please follow the checkpoints.");
}
else
{
SendClientMessage(playerid, WHITE, "You must be in a sweeper to sweep the streets.");
}
return 1;
}
Re: Vehicle help. -
iGetty - 05.08.2011
THanks mate, appreciated. +1 rep.
Re: Vehicle help. -
Tigerkiller - 05.08.2011
it cant work because vehicleid isnt defined
this is correct
pawn Код:
command(sweep, playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new Model = GetVehicleModel(vehicleid);
if(Model == 574)
{
Sweepcp[playerid] = 1;
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.2069, 3.0);
SendClientMessage(playerid, 0xFFFFFFFF, "You have started to sweep the streets, Please follow thecheckpoints.");
}
else
{
SendClientMessage(playerid, WHITE, "You must be in a sweeper to sweep the streets.");
}
return 1;
}
Re: Vehicle help. -
=WoR=Varth - 06.08.2011
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
Re: Vehicle help. -
Tigerkiller - 06.08.2011
yes this works too bu with the other option he can see the models easter and the line is not to long
Re: Vehicle help. -
MadeMan - 06.08.2011
You can also make a stock for that if you need to check it in many places
pawn Код:
stock IsSweeper(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 574: return 1;
}
return 0;
}
pawn Код:
command(sweep, playerid, params[])
{
if(IsSweeper(GetPlayerVehicleID(playerid)))
{
Sweepcp[playerid] = 1;
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.2069, 3.0);
SendClientMessage(playerid, 0xFFFFFFFF, "You have started to sweep the streets, Please follow the checkpoints.");
}
else
{
SendClientMessage(playerid, WHITE, "You must be in a sweeper to sweep the streets.");
}
return 1;
}