Command Bug
#1

I made a /goto and /tgoto (disable) commands.
All worked fine except that when I typed /goto, it didn't said "USAGE: /Goto [playerid].
So I try to fix it and when I test it, it always appears the text "You have teleport to Harry_Potter" in every command.
In every tele, it appeared this message and teleported to the bot.
I delete the /goto command from the gamemode and I tried to test it again. But again this appears.
I open the gamemode and I Ctrl + F to find the text "You have teleport" and text no found.
How it appears ingame, I deleted.
Please Help me!
Reply
#2

Sounds like you're not changing the script that is actually running on the server, make sure you're changing the right one. Also I assume you know this, but just in-case, you should know that you need to restart the server to see any changes made to a gamemode.
Reply
#3

I delete the /goto command and I let the /tgoto, but at /tgoto there is only AllowGoto.
Can this be derived from /tgoto.
Also I delete only the goto from this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128];
    new idx;
    if ( strcmp( cmd, "/goto", true ) == 0 ) {
        new tmp[256];
        tmp = strtok( cmdtext, idx );
        if ( !strlen( tmp ) ) { return 1; }
        new pID = strval(tmp);
        if(!strlen(cmdtext)) return SendClientMessage(playerid, 0xFF0000AA, "/Goto [playerid]");
        else if( pID == INVALID_PLAYER_ID || !IsPlayerConnected( pID ) ) return SendClientMessage( playerid, COLOR_RED, "Player is not connected!" );
        else if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot goto yourself");
        else if(AllowGoto[pID] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has prevent teleporting to them");
        else {
            new Float:X, Float:Y, Float:Z, Pname[24];
            GetPlayerPos( strval(tmp), X, Y, Z );
            ResetPlayerWeapons(playerid);
            if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
            else SetPlayerPos( playerid, X+2, Y+2, Z );
            new String[56];
            GetPlayerName(strval(tmp), Pname, sizeof(Pname));
            format(String, sizeof(String), "{FF9600}You teleported to %s.", Pname, strval(tmp));
            SendClientMessage(playerid, COLOR_ORANGE, String);
            GetPlayerName(playerid, Pname, sizeof(Pname));
            format(String, sizeof(String), "{FF9600}%s has teleported to your location, type /tgoto to disable this in the future!", Pname, playerid);
            SendClientMessage(strval(tmp), COLOR_ORANGE, String);
        }
        return 1;
    }
    if (strcmp(cmdtext, "/tgoto", true, 10) == 0) {
        ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FFFFFF}Toggle Goto", "{00FF00}Enable\n{FF0000}Disable", "Select", "Cancel");
        return 1;
    }
    new tmp[256];
    if(strcmp(cmd, "/carcolor", true) == 0) {
//More
To this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128];
    new idx;
    if (strcmp(cmdtext, "/tgoto", true, 10) == 0) {
        ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FFFFFF}Toggle Goto", "{00FF00}Enable\n{FF0000}Disable", "Select", "Cancel");
        return 1;
    }
    new tmp[256];
    if(strcmp(cmd, "/carcolor", true) == 0) {
//More
Edit: I test it at localhost:7777 before upload them on the server.
Reply
#4

pawn Код:
if ( strcmp( cmd, "/goto", true ) == 0 ) {
        new tmp[32];
        tmp = strtok( cmdtext, idx );
        if ( !strlen( tmp ) ) { return SendClientMessage(playerid, 0xFF0000AA, "/Goto [playerid]"); }
        new pID = strval(tmp);
        else if( pID == INVALID_PLAYER_ID || !IsPlayerConnected( pID ) ) return SendClientMessage( playerid, COLOR_RED, "Player is not connected!" );
        else if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot goto yourself");
        else if(AllowGoto[pID] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has prevent teleporting to them");
        else {
            new Float:X, Float:Y, Float:Z, Pname[24];
            GetPlayerPos( strval(tmp), X, Y, Z );
            ResetPlayerWeapons(playerid);
            if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
            else SetPlayerPos( playerid, X+2, Y+2, Z );
            new String[56];
            GetPlayerName(strval(tmp), Pname, sizeof(Pname));
            format(String, sizeof(String), "{FF9600}You teleported to %s.", Pname, strval(tmp));
            SendClientMessage(playerid, COLOR_ORANGE, String);
            GetPlayerName(playerid, Pname, sizeof(Pname));
            format(String, sizeof(String), "{FF9600}%s has teleported to your location, type /tgoto to disable this in the future!", Pname, playerid);
            SendClientMessage(strval(tmp), COLOR_ORANGE, String);
        }
        return 1;
    }
Reply
#5

Still nothing. It appears the Message You have teleported to Harry_Potter ( id 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)