OnPlayerCommandText Teleport Problem
#1

I have:
but when i type /teleport he said: unknow command..
I tried without FS.. same shit
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/teleport", true) == 0)
{
        SetPlayerPos(playerid,948.5627,-865.7071,84.1467);
        GameTextForPlayer(playerid, "~g~You teleported to the map!", 4000, 5);
        return 1;

    }
    if(strcmp(cmdtext, "/kill", true) == 0 || strcmp(cmdtext, "/suicide", true) == 0)
    {
        SetPlayerHealth(playerid, 0);
        GameTextForPlayer(playerid, "~r~Suicide", 3000, 1);
        return 1;

    }
    return 0;
}
Reply
#2

Did you compile? Is the script loaded?
Reply
#3

Here is how you should do it.

if (strcmp(cmdtext, "/teleport", true, 10) == 0)
{
SetPlayerPos(playerid, 948.5627,-865.7071,84.1467);
GameTextForPlayer(playerid, "~g~You teleported to the map!", 4000, 5);
return 1;
}


true) == 0) <<< you need to make it like this "if (strcmp(cmdtext, "/teleport, true, 10) == 0)
Reply
#4

No, that's not the case, Twinki1993.

The length parameter is optional, there's not really any need for it, and even so that's completely wrong, '/teleport' is not 10 characters, and you've missed a quotation mark.
Reply
#5

Yes i compile it and the script is loaded..
Reply
#6

I thought it itsn't :P

He must get some errors since look at this

if (strcmp(cmdtext, "/teleport", true) == 0)
{

Code is basically on the middle and opening bracket at the beggining. He's loosing indetification somewhere for sure.
Reply
#7

The GM: http://pastebin.com/jFbGEXng

What is the problem?
Reply
#8

Here you go.

http://pastebin.com/reA4iJzZ
Reply
#9

Wrong upload.

Whole thing:
http://pastebin.com/ngL1D1BU

You have placed everything to FS and you are making a GM. I changed it.
Reply
#10

... still don't teleport.. unknow command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)