PDA

View Full Version : OnPlayerCommandText Teleport Problem


RedixHD
13/11/2011, 12:53 AM
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;
}

MP2
13/11/2011, 12:54 AM
Did you compile? Is the script loaded?

Twinki1993
13/11/2011, 12:55 AM
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)

Calgon
13/11/2011, 12:57 AM
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.

RedixHD
13/11/2011, 12:59 AM
Yes i compile it and the script is loaded..

Twinki1993
13/11/2011, 12:59 AM
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.

RedixHD
13/11/2011, 01:01 AM
The GM: http://pastebin.com/jFbGEXng

What is the problem?

Twinki1993
13/11/2011, 01:03 AM
Here you go.

http://pastebin.com/reA4iJzZ

Twinki1993
13/11/2011, 01:05 AM
Wrong upload.

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

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

RedixHD
13/11/2011, 01:14 AM
... still don't teleport.. unknow command :|

MP2
13/11/2011, 02:56 AM
Put "print("DEBUG");" on the first line of OnPlayerCommandText and see if it appears in the console when you type the command. If it doesn't, it's not getting called. If it's not getting called, make sure you return 0 in all other OnPlayerCommandText callbacks.