[help]little help here, please - 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: [help]little help here, please (
/showthread.php?tid=275416)
[help]little help here, please -
Dirkon - 09.08.2011
So I was making CMDs related with vehicles and if really I don't get it why this works:
pawn Код:
if(!strcmp(cmdtext,"/engine",true))
{
new carid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
new IsOwner[MAX_PLAYER_NAME];
GetPlayerName(playerid, IsOwner, sizeof(IsOwner));
new vehicleid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(strmatch(CarInfo[vehicleid][owner], IsOwner))
{
if(CarInfo[carid][fuel] > 0)
{
if(engine == 0)
{
SetVehicleParamsEx(carid,1,lights,alarm,doors,bonnet,boot,objective);
}
if(engine == 1)
{
SetVehicleParamsEx(carid,0,lights,alarm,doors,bonnet,boot,objective);
}
}
}
else
{
}
}
return 1;
}
and this not
pawn Код:
if(!strcmp(cmdtext,"/lock",true))
{
new carid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
for(new i = 0; i < MAX_VEHICLES; i++)
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
if(VehicleToPoint(5, i, px, py, pz))
{
new IsOwner[MAX_PLAYER_NAME];
GetPlayerName(playerid, IsOwner, sizeof(IsOwner));
if(strmatch(CarInfo[i][owner], IsOwner))
{
if(doors == 0)
{
SetVehicleParamsEx(i,engine,lights,alarm,1,bonnet,boot,objective);
}
if(doors == 1)
{
SetVehicleParamsEx(i,engine,lights,alarm,0,bonnet,boot,objective);
}
}
}
}
return 1;
}
Engine turns up and off with /engine cmd, but car just get's locked with /lock. Why is that? Why it doesn't lock and unlock car with the same CMD? Can anyone help me?
P.S. Sorry for possible grammar mistakes.
Re: [help]little help here, please -
orrgoren11 - 09.08.2011
I think you need to make a loop throug all players, and like - lock the car for them ...