Disable player goto you
#1

hey guys,
i wonder if its possible to disable goto for proticular player?
like, in my server goto goto is for everyone, but sometimes it is annoying when players goto me without permission..
so i wonder like if i type for example, /disablegotome and /enablegotome so that if you type /disablegotome noone will be able to goto you and will write "error that player does not want anyone near him"

would be good if you can help me with it, thanks.
Reply
#2

you can do that by using an array,
pawn Код:
new bool:cgoto[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[]){
    if(!strcmp(cmdtext, "/enablegotome", true)){
        if(cgoto[playerid])return SendClientMessage(playerid, 0xFFFF00FF, "Server: You have already allow other players goto tou.");
        cgoto[playerid] = true;
        return SendClientMessage(playerid, 0x00FF00FF, "Server: You have allowed other players goto you");
    }
    if(!strcmp(cmdtext, "/disablegotome", true)){
        if(!cgoto[playerid])return SendClientMessage(playerid, 0xFFFF00FF, "Server: You have already forbid other players goto you");
        cgoto[playerid] = false;
        return SendClientMessage(playerid, 0xFF0000FF, "Server: You have forbid other players goto you");
    }
    if(!scrcmp(cmdtext, "/goto", true)){
        //code
        if(!cgoto[gotoid])return SendClientMessage(playerid, 0xFF0000FF, "ERROR: This players don0t admit other players to teleport to him");
        //teleport the player to the gotoidplayer
        //gotoid = the player that the playerid want to teleport to.
    }
    return 0;
}
Sorry for my english but i'm from argentina.
Reply
#3

Goto is a reserved keyword in Pawn. Change the goto variable to anything else.
Reply
#4

are you wanting it so it doesn't go to a particular name or a team that the player is in
Reply
#5

Quote:
Originally Posted by Elder_of_Zion
Посмотреть сообщение
I have a command called "goto" that works perfectly? Does it matter if you use it like that?
Commands named goto are fine, but variables name goto will confuse the compiler. It is a reserved keyword.
Reply
#6

its just for player not the team.

btw thanks for the full code but when i compile it i get those errors:
D:\Server\server\gamemodes\1337.pwn(732) : error 020: invalid symbol name ""
D:\Server\server\gamemodes\1337.pwn(736) : error 029: invalid expression, assumed zero
D:\Server\server\gamemodes\1337.pwn(736) : error 029: invalid expression, assumed zero
D:\Server\server\gamemodes\1337.pwn(736) : warning 215: expression has no effect
D:\Server\server\gamemodes\1337.pwn(736) : error 001: expected token: ";", but found "]"
D:\Server\server\gamemodes\1337.pwn(736) : fatal error 107: too many error messages on one line
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)