/coplights command - 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: /coplights command (
/showthread.php?tid=372702)
/coplights command -
Jay_Dixon - 27.08.2012
Here's the cmd, and and below it's the errors. Having huge trouble on it, and wondering what i'm doing wrong. If someone can tell me how to fix them, that'd be great.
Код:
if(strcmp(cmd, "/coplights", true) == 0)
new vehicle = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(Coplights[playerid] == 0)
{
new objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000); //Object Model: 19419
format(string, sizeof(string), "%s has attached coplights to their car.", sendername);
ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Coplights[playerid] = 1;
}
else
{
DestroyObject(objectid, GetPlayerVehicleID(playerid));
format(string, sizeof(string), "%s has removed the coplights from their car.", sendername);
ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Coplights[playerid] = 0;
}
return 1;
}
Errors:
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27062) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27062) : error 017: undefined symbol "vehicle"
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27075) : error 017: undefined symbol "objectid"
Re: /coplights command -
ikkentim - 27.08.2012
after if(strcmp(cmd, "/coplights", true) == 0)
Put a {
and at the end of that piece of code a }
Re: /coplights command -
Jay_Dixon - 27.08.2012
Quote:
Originally Posted by ikkentim
after if(strcmp(cmd, "/coplights", true) == 0)
Put a {
and at the end of that piece of code a }
|
Thanks, that fixed a couple of the errors, now my major problem is with
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27076) : error 017: undefined symbol "objectid"
I don't get how it's a undefined symbol, when it's used in the script tons of times, and doesn't give a problem there. Why on /coplights?