Making commands[Need some help please]
#1

This may sound nooby, but im a noob haha. When i make a command:

Код HTML:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
	{
	    SetPlayerPos(playerid,1201.29,-1325.50,13.40);
		SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
		return 1;
	}
	return 0;
}
If i want to make another command in the script, what do i have to do? do i have to put public OnplayerCommandText(playerid, cmdtext[]) or do i just start at "if"? Also, what do i have to return the values too?

Thanks in advanced
Reply
#2

Like this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid,1201.29,-1325.50,13.40);
        SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
        return 1;
    }
        if(strcmp("/example",cmdtext,true,10) == 0)
        {
         SetPlayerPos(playerid, 342,234,234);
         return 1;
         }
        //Another command here
    return 0;
}
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid,1201.29,-1325.50,13.40);
        SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
        return 1;
    }
    else if(!strcmp(cmdtext,"/example",true))
    {
        // Post your function.
        return 1;
    }
    return 0;
}
Reply
#4

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)