Scripting Problem?
#1

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?
Reply
#2

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.
Reply
#3

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
Reply
#4

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 ^
Reply
#5

Код:
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
Reply
#6

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.
Reply
#7

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?
Reply
#8

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.
Reply
#9

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
Reply
#10

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.
{

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)