/carlock - 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: /carlock (
/showthread.php?tid=164650)
/carlock -
Mystique - 01.08.2010
So, I've gotten stuck on this problem with the /carlock command. For some reason it won't detect that I'm the owner of the vehicle even if I am and leads to that I can't lock it even if I own it.
Код:
if(strcmp(cmd, "/carlock", true) ==0)
{
if(GetClosestVehicle(playerid, 5))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (strmatch(CarSystem[GetClosestVehicle(playerid,5)][Carowner],pName(playerid)))
{
CarLock[GetClosestVehicle(playerid,5)] = 1;
SetVehicleParamsForPlayer(GetClosestVehicle(playerid,5),i,0,1);
new str[128];
format(str, sizeof(str), "*%s presses a key which locks the doors of the vehicle", pName(playerid));
ProxDetector(30.0,playerid,str,MECHAT,MECHAT,MECHAT,MECHAT,MECHAT);
return 1;
}
}
}
return 1;
}
Re: /carlock -
Mystique - 03.08.2010
Bumping..
Re: /carlock -
Mauzen - 03.08.2010
Try using strcmp instead of strmatch (
https://sampwiki.blast.hk/wiki/Strcmp)
Re: /carlock -
PotH3Ad - 03.08.2010
Give this a try, should work...
pawn Код:
if(!strcmp(cmd, "/carlock", true, 8))
{
if(GetClosestVehicle(playerid, 5))
{
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(!strcmp(CarSystem[GetClosestVehicle(playerid,5)][Carowner], pName(playerid), true))
{
CarLock[GetClosestVehicle(playerid,5)] = 1;
SetVehicleParamsForPlayer(GetClosestVehicle(playerid,5),i,0,1);
new str[95];
format(str, sizeof(str), "*%s presses a key which locks the doors of the vehicle", pName(playerid));
ProxDetector(30.0,playerid,str,MECHAT,MECHAT,MECHAT,MECHAT,MECHAT);
}
}
}
return 1;
}
Re: /carlock -
Kar - 03.08.2010
what the hell is strmatch
Re: /carlock -
Mystique - 04.08.2010
strmatch is a stock that I created which checks if the two strings matches each other. I'll try out the strcmp now so thank you.
Re: /carlock -
Mystique - 04.08.2010
Quote:
Originally Posted by PotH3Ad
Give this a try, should work...
pawn Код:
if(!strcmp(cmd, "/carlock", true, 8)) { if(GetClosestVehicle(playerid, 5)) { for(new i = 0; i != MAX_PLAYERS; i++) { if(!strcmp(CarSystem[GetClosestVehicle(playerid,5)][Carowner], pName(playerid), true)) { CarLock[GetClosestVehicle(playerid,5)] = 1; SetVehicleParamsForPlayer(GetClosestVehicle(playerid,5),i,0,1); new str[95]; format(str, sizeof(str), "*%s presses a key which locks the doors of the vehicle", pName(playerid)); ProxDetector(30.0,playerid,str,MECHAT,MECHAT,MECHAT,MECHAT,MECHAT); } } } return 1; }
|
Did not work, I can now unlock and lock all of the vehicles. I also tried to remove the "!" but then I could also lock all vehicles.
Re: /carlock -
Mystique - 06.08.2010
Bumb once again...
Re: /carlock -
speediekiller2 - 06.08.2010
Quote:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
if(strcmp(cmd, "/carlock", true) ==0)
{
if(GetClosestVehicle(playerid, 5))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (strmatch(CarSystem[GetClosestVehicle(playerid,5)][Carowner],pName(playerid)))
{
CarLock[GetClosestVehicle(playerid,5)] = 1;
SetVehicleParamsForPlayer(GetClosestVehicle(player id,5),i,0,1);
new str[128];
format(str, sizeof(str), "*%s presses a key which locks the doors of the vehicle", pName(playerid));
ProxDetector(30.0,playerid,str,MECHAT,MECHAT,MECHA T,MECHAT,MECHAT);
return 1;
}
}
}
return 0;
}
#endif
|
Maybe so XD
Re: /carlock -
Mystique - 06.08.2010
Why would it work with return 0;? Anyways, I think I'll try another system with this. Still feel free to post suggestions on fixing this command.