SA-MP Forums Archive
OnPlayerCommandText Teleport Problem - 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)
+--- Thread: OnPlayerCommandText Teleport Problem (/showthread.php?tid=296786)



OnPlayerCommandText Teleport Problem - RedixHD - 13.11.2011

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;
}



Re: OnPlayerCommandText Teleport Problem - MP2 - 13.11.2011

Did you compile? Is the script loaded?


Re: OnPlayerCommandText Teleport Problem - Twinki1993 - 13.11.2011

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)


Re: OnPlayerCommandText Teleport Problem - Calgon - 13.11.2011

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.


Re: OnPlayerCommandText Teleport Problem - RedixHD - 13.11.2011

Yes i compile it and the script is loaded..


Re: OnPlayerCommandText Teleport Problem - Twinki1993 - 13.11.2011

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.


Re: OnPlayerCommandText Teleport Problem - RedixHD - 13.11.2011

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

What is the problem?


Re: OnPlayerCommandText Teleport Problem - Twinki1993 - 13.11.2011

Here you go.

http://pastebin.com/reA4iJzZ


Re: OnPlayerCommandText Teleport Problem - Twinki1993 - 13.11.2011

Wrong upload.

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

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


Re: OnPlayerCommandText Teleport Problem - RedixHD - 13.11.2011

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