SA-MP Forums Archive
Little coding Help needed! - 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: Little coding Help needed! (/showthread.php?tid=380723)



Little coding Help needed! - Jason_Dealley - 26.09.2012

Hay der!
So i want to script my first FS it will be a simple command wich says someone has asked for airsupport can i have some help? here is what i got:
Код:
// Jasons bombing request script!//

#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>

/*** Colors ***/
#define COLOR_GREEN 0x008000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BRIGHTRED 0xFF000AAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_BEIGE 0xFFF8DCAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTERBLUE 0x00BFFFAA
#define COLOR_BLUELIGHT 0x1E90FFAA
#define COLOR_BLUEMEDIUM 0x0000CDAA
#define COLOR_BLUEDARK 0x00008BAA
#define COLOR_PINK 0xFF1493AA
#define COLOR_PINKDARK 0xFF00FFAA
#define COLOR_GREENLIGHT 0x00FF00AA
#define COLOR_GREENDARK 0x006400AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OKER 0x808000AA
#define COLOR_ORANGE 0xFF4500AA
#define COLOR_ORANGELIGHT 0xFF8C00AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_VIOLETDARK 0x9400D3AA
#define COLOR_INDIGO 0xAB0082AA
#define COLOR_RED 0xFF0000AA
#define COLOR_SAND 0xFFDEADAA
#define COLOR_SILVER 0xC0C0C0AA
#define COLOR_TEAL 0x008080AA
#define COLOR_WHITE 0xFFFFFFAA

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Jasons Bombing Requests");
	print("--------------------------------------\n");
	return 1;
}

CMD:airsupport
{
	SendClientMessageToAll(0x00FFFFAA, " Support has been called in, take cover!!!");
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
This me this problem:
Код:
C:\Users\Volkers\Desktop\ie4mp\filterscripts\BombRequest.pwn(45) : error 010: invalid function or declaration
C:\Users\Volkers\Desktop\ie4mp\filterscripts\BombRequest.pwn(47) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
More info: i use zcmd!
Edit: added more info.


Re: Little coding Help needed! - Lutz - 26.09.2012

You have shown us the code, but what exactly are lines 45 and 47?


Re: Little coding Help needed! - Jason_Dealley - 26.09.2012

i think you have more with 44 till 48:

Код:
CMD:airsupport
{
	SendClientMessageToAll(0x00FFFFAA, " Support has been called in, take cover!!!");
	return 1;
}
CMD:airsupport= 44
{=45
SendClientMessageToAll(0x00FFFFAA, " Support has been called in, take cover!!!"); = 46
return 1; = 47
} = 48


Re: Little coding Help needed! - Lutz - 26.09.2012

Oh my.. I don't know how I missed it the first reading, but the way to use zcmd is "CMD:airsupport(playerid, params[])". Change line 44 to that, and you should be fine. Also reading more on zcmd could never hurt (to explain things such as "params[]").


Re: Little coding Help needed! - Jason_Dealley - 26.09.2012

Thanks man! +rep!


Re: Little coding Help needed! - Jason_Dealley - 26.09.2012

Need some more help i want to add so that it also creates a flare at the place u stand and that this would destroy itself in 1 minute, is that possible?


Re: Little coding Help needed! - Lutz - 26.09.2012

Yes, first you would need to find the object ID for a flare (I believe 18728 is a red flare). From there you would get the players position, after doing so, create the object at the position (normally with an offset of the players position i.e CreateObject(18728, playerX+2, playerY+2, playerZ, ...,)). Then you simply set a timer for one minute and delete the object.


Re: Little coding Help needed! - Jason_Dealley - 26.09.2012

oke cool
it worked thanks!