[Help] Need help with a teleport command
#1

I'm new to scripting and would like to know why I'm getting the following error:

error 017: undefined symbol "cmdtxt"


this is my teleport command:


public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/grove", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,0,2495.3669,-1687.3278,13.5156,5.6401); //
SetPlayerInterior(playerid, 0);
return 1;
}

if (strcmp ("/stadium", cmdtxt, true, 10) == 0)
{
SetPlayerInterior(playerid, 4);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid, -1424.9319,-664.5869,1059.8585);
SetPlayerFacingAngle(playerid, 0);
SendClientMessage(playerid, 0x7F00FFBE, "Welcome to Dirt Bike Stadium");
return 1;
}

return 0;

}



before I had the 2nd teleport command it worked fine, I would like to know how to properly put a 2nd teleport command here.
help is much appreciated thanks
Reply
#2

The variable is "cmdtext" not "cmdtxt" as you can see by reading the callback. If you read the error you will also see that the problem is explained quite well! Also why do you specify a length of 10 in the strcmp function? Why specify a length at all? It is useless in these cases.
Reply
#3

lol I'm so noob haha thanks! yeah I totally oversaw that ^^

and about the "true, 10" I saw it in a tutorial don't know the point of it neither, but I thought it's needed

thanks again ^^
Reply
#4

Quote:
Originally Posted by daonlygangsta7
Посмотреть сообщение
lol I'm so noob haha thanks! yeah I totally oversaw that ^^

and about the "true, 10" I saw it in a tutorial don't know the point of it neither, but I thought it's needed

thanks again ^^
You can see the usage of those parameters here:

https://sampwiki.blast.hk/wiki/Strcmp

They are both optional, although the length one is usually useless in most cases, certainly in the commands area. There is no need to specify it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)