[HELP] /lock - 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] /lock (
/showthread.php?tid=172844)
[HELP] /lock -
Fredden1993 - 31.08.2010
Yo, I just found a lock command for vehicles:
Код:
if(strcmp(cmdtext, "/lock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State;
State = GetPlayerState(playerid);
if(State! = PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_GREY,"You can only lock the doors as the driver.");
return 1;
}
new i;
new Float:pX, Float:pY, Float:pZ;
for(i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
format(string, sizeof(string), "~r~Locked");
GameTextForPlayer(playerid, string, 3000, 5);
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!");
}
return 1;
}
And I just get this error:
Код:
expected token: ")", but found "!"
Thanks for the help
Re: [HELP] /lock -
Voldemort - 31.08.2010
pawn Код:
if(strcmp(cmdtext, "/lock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) = PLAYER_STATE_DRIVER)
{
new Float:pX, Float:pY, Float:pZ;
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
}
format(string, sizeof(string), "~r~Locked");
GameTextForPlayer(playerid, string, 3000, 5);
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You can only lock the doors as the driver.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!");
}
return 1;
}
But I suggest you to use something else, this cmd is s***s, I mean make other way how you lock the cars.
You will also need a global thing what will lock car for new players who connect
Re: [HELP] /lock -
firebat - 31.08.2010
Код:
if(State! = PLAYER_STATE_DRIVER)
should become
Код:
if(State != PLAYER_STATE_DRIVER)