SA-MP Forums Archive
Scripting Problem? - 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: Scripting Problem? (/showthread.php?tid=112896)



Scripting Problem? - devteamsnDOTcom - 11.12.2009

Ok, I am kind of new to scripting, and I wanted to know if you guys knew this problem. I have a command set up as /carhelp to show help for your car. The command works fine, but underneath the car help, it says that the command is unknown, I do not know why. It also says it for every command except for /help. Anyone know why?


Re: Scripting Problem? - Snyper18 - 11.12.2009

Do you have a "return 1;" at the end of the code? If you dont know how to do it, pass me the command and I'll show you.


Re: Scripting Problem? - devteamsnDOTcom - 11.12.2009

well I didn't have it, But I entered it and it is stills showing up.....

Here is the command for my 911, so far... not done yet
Код:
	//start /911
	if (strcmp("/911", cmdtext, true, 10) == 0)
	{
	  SendClientMessage(playerid, 0xff0000AA,"|_________________911_________________|");
		SendClientMessage(playerid, 0x00ff00AA,"Hello, This is the communications center");
		SendClientMessage(playerid, 0x00ff00AA,"Please type police, paramedic, or fire!");
		return 1;
	}
	//end /911



Re: Scripting Problem? - Snyper18 - 11.12.2009

Quote:
Originally Posted by devteamsnDOTcom
well I didn't have it, But I entered it and it is stills showing up.....

Код:
	//start /911
	if(strcmp(cmd, "/911",true) == 0)
	{
	    SendClientMessage(playerid, 0xff0000AA,"|_________________911_________________|");
		SendClientMessage(playerid, 0x00ff00AA,"Hello, This is the communications center");
		SendClientMessage(playerid, 0x00ff00AA,"Please type police, paramedic, or fire!");
		return 1;
	}
	//end /911
Try this now, the script above ^


Re: Scripting Problem? - devteamsnDOTcom - 11.12.2009

Код:
C:\Program Files\Rockstar Games\GTA San Andreas 2\server\gamemodes\NathansRoleplay.pwn(134) : error 017: undefined symbol "cmd"
C:\Program Files\Rockstar Games\GTA San Andreas 2\server\gamemodes\NathansRoleplay.pwn(137) : warning 217: loose indentation



Re: Scripting Problem? - Snyper18 - 11.12.2009

Alright, you see the "New variables" under the OnPlayercommand?

Add this with them.

Quote:

new cmd[256];

Example :

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];

Then goes the rest of the code, the loose indentation is just you need to fix the line to match with the others.


Re: Scripting Problem? - devteamsnDOTcom - 11.12.2009

Thanks, It worked.... One more thing, Do you know how to make it so that there is like a new thing like you know how it goes return 1;
can I define my own place... like 5, then if something happens, return to 5?


Re: Scripting Problem? - Snyper18 - 11.12.2009

Er... I dont understand what you mean, If you mean if you have a ... loop running 5 times, and you want to return 5; Theres no need, just put a
Quote:

"break;"

at the end of the code.


Re: Scripting Problem? - devteamsnDOTcom - 11.12.2009

I want to make my 911 command be like where you type Paramedic Police or Fire, and if you dont enter one of those, it says the 911 usage..... u know?

Plus, Now if I enter any command, the 911 command shows, like I also have /carhelp but the 911 text shows when I do that


Re: Scripting Problem? - Snyper18 - 11.12.2009

You would have to search for that, I cant really help as im about to go to bed, also replace your command's with my command procedure?

Ex of what I mean : Replace the /carhelp command with the following command, do this for all of them.

Quote:

if(strcmp(cmd, "/(Commandname)", true) == 0) // Also, please note to delete the ( ) on the command.
{