SA-MP Forums Archive
I need help - 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: I need help (/showthread.php?tid=139897)



I need help - [TW]randomguy - 06.04.2010

I made some commands in pawno and I go on my server and use the command and it says: SERVER: unknown command
Why wont they work?
What am i doing wrong?


Re: I need help - andmeida10 - 06.04.2010

show your command... we don't guess


Re: I need help - [TW]randomguy - 06.04.2010

Quote:
Originally Posted by andmeida10
show your command... we don't guess
Код:
	if(strcmp(cmd, "/moutbike", true) == 0)
{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
	return 1;
}
That's one of them


Re: I need help - aircombat - 06.04.2010

use dcmd+sscanf they are alot easier from strcmp + strtok


Re: I need help - [TW]randomguy - 06.04.2010

Quote:
Originally Posted by [AC
Etch ]
use dcmd+sscanf they are alot easier from strcmp + strtok
Still doesn't work...


Re: I need help - DeadalusNetwork - 06.04.2010

Quote:
Originally Posted by [TW
randomguy ]
Quote:
Originally Posted by [AC
Etch ]
use dcmd+sscanf they are alot easier from strcmp + strtok
Still doesn't work...
Maybe your typing it in another language , turkish or something?Maybe your "u" contains an umlaut ( the german crap ) or something.


Re: I need help - dice7 - 06.04.2010

Post your OnPlayerCommandText


Re: I need help - [TW]randomguy - 07.04.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/hydra", cmdtext, true, 10) == 0)
	{
		{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
	return 1;
}
That is the code to create the command "/hydra" which spawns a hydra.


Re: I need help - biltong - 07.04.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/yourcmd", cmdtext, false))
    {
        //bla bla bla
        return 1;
    }
    if(!strcmp("/anothercmd", cmdtext, false))
    {
        //more bla bla bla
        return 1;
    }
    return 0; //make absolute sure this is the last line in OnPlayerCommandText.
}
Make sure your commands look similar to that, and make sure you return 0 at the end of them all.

EDIT:
Quote:
Originally Posted by [TW
randomguy ]
Код:
	if(strcmp(cmd, "/moutbike", true) == 0)
{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
	return 1;
}
Maybe it's because you spelled "mountain bike" or "mount bike" wrong?


Re: I need help - -Rebel Son- - 07.04.2010

Quote:
Originally Posted by [TW
randomguy ]
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/hydra", cmdtext, true, 10) == 0)
	{
		{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
	return 1;
}
That is the code to create the command "/hydra" which spawns a hydra.
Let me give you a lesson lol, See your opening brackets? theres not as many closed brackets to be equal.

Код:
	if (strcmp("/hydra", cmdtext, true, 10) == 0)
	{
	{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
	}
    return 1;
    }
But it looks like one of those top brackets are useless? so try this.

Код:
	if (strcmp("/hydra", cmdtext, true, 10) == 0)
	{
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	CreateVehicle(510, x+1, y+1, z+1, 0, 0, 0, 600);
	SetVehicleZAngle(VehicleID, ang);
    return 1;
    }