teleport cmds fail help plz!!!
#1

i want add those teleport cmds lva sfa... to a satdm server and i find the cmds and compiled them and everything works but when i loaded the game the cmds don't work it says cmd not found try another.......
can any one help me plz
this is what i putted in the gamemode:

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/lsa", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1990.6156,-2335.7556,13.5469);
SetPlayerFacingAngle(playerid, 82.8390);
SendClientMessage(playerid, COLOR_GREEN, "You have been teleported.");
return 1;
}
if (strcmp("/sfa", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -1196.7540,-162.0608,14.1484);
SetPlayerFacingAngle(playerid, 90.3707);
SendClientMessage(playerid, COLOR_GREEN, "You have been teleported.");
return 1;
}
if (strcmp("/lva", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1319.4534,1262.0178,10.8203);
SetPlayerFacingAngle(playerid, 359.4272);
SendClientMessage(playerid, COLOR_GREEN, "You have been teleported.");
return 1;
}
return 0;
}

if u need the game mode to solve the problem tell me and i will give it to u.
Reply
#2

Change those numbers from 10 to 3. Should work.
Reply
#3

i changed them to 3 but still don't work!!!!!!
Reply
#4

Meh, Try this:
pawn Код:
if (!strcmp("/lsa", cmdtext, true))
{ //things }

if (!strcmp("/sfa", cmdtext, true))
{ //things }

if (!strcmp("/lva", cmdtext, true))
{ //things }
Reply
#5

Woops, Sorry my bad, I forgot to add something to the code.
This should do it

pawn Код:
new cmd[256], idx; //This on beginning of OnPlayerCommand
cmd = strtok(cmdtext, idx); //This on beginning of OnPlayerCommand
Reply
#6

i used your cmds but i got this errors when compiling
C:\Documents and Settings\Administrateur\Bureau\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(28437) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Administrateur\Bureau\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(28437) : error 017: undefined symbol "idx"
C:\Documents and Settings\Administrateur\Bureau\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(28439) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Administrateur\Bureau\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(28443) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Administrateur\Bureau\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(28447) : error 017: undefined symbol "cmd"
plz im really despered!!!!
Reply
#7

Add this before cmd = strtok....

pawn Код:
new idx, cmd[256];
Reply
#8

Try this one:
Код:
if(strcmp(cmd,"/goto",true)
{
SetPlayerPos(playerid, X, Y ,Z );
SetPlayerFacing..etc(playerid, X, Y Z);
}
Reply
#9

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
Add this before cmd = strtok....

pawn Код:
new idx, cmd[256];
Yes Indeed, Sorry ahmed forgot to add that above it >_<.
I hope it works now for you.
Reply
#10

thx every body it worked forme thx again))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)