Several commands, error ???
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/skatepark", cmdtext, true, 10) == 0)
    {
    SetPlayerPos(playerid,1893.8850,-1388.2507,13.5703);
    SendClientMessage(playerid, COLOR_BLACK , "Have fun in skatepark!");
        // Do something here
    }
    if (strcmp("/commands", cmdtext, true, 10) == 0)
    {
            SendClientMessage(playerid,COLOR_YELLOW, "/skatepark");
	}
	if (strcmp("/kill", cmdtext, true, 10) == 0)
			SetPlayerHealth(playerid,0.0);
	}
			 return 1;
    }
	return 0;
}
Код:
And I get this error
C:\Documents and Settings\Дgaren\Skrivbord\SERVER\gamemodes\Hudgens.pwn(136) : error 010: invalid function or declaration
C:\Documents and Settings\Дgaren\Skrivbord\SERVER\gamemodes\Hudgens.pwn(138) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

what are lines 136 and 138? by the way, improve your identation
Reply
#3

sorry for double post but i actually found why, you had a missing bracket and a missing ; semicolon, and other thing, always add return to your command or it will say SERVER: Unknown command

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/skatepark", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid,1893.8850,-1388.2507,13.5703);
        return SendClientMessage(playerid, COLOR_BLACK , "Have fun in skatepark!");
    }
    if (strcmp("/commands", cmdtext, true, 10) == 0)
    {
        return SendClientMessage(playerid,COLOR_YELLOW, "/skatepark");
    }
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        return SetPlayerHealth(playerid,0.0);
    }
    return 0;
}
Reply
#4

Thanks, I'm new to scripting : )
Reply
#5

Quote:
Originally Posted by Hudgens
Посмотреть сообщение
Thanks, I'm new to scripting : )
no problem i was like you once im still newb but learning, remember always return values in your command to avoid SERVER: Unknown command and improve your identation for easier reading.

P.S: i made a small mistake, re read my code.
Reply
#6

I saw that u missed return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)