gamemode crash
#1

some people come to my server and crash my mode how i can protect the mode from the crash??
somtimes they do the command:
/stats 11111111111111111111
very much times and the mode down

sorry for the bad English

someone help pliz
Reply
#2

Limit the /stats command then.
If you don't know how, show us the command
Reply
#3

Код:
if(!strcmp(cmd, "/stats", true)) {
		new sid[256], id;
		sid = strtok(cmdtext,idx);
    if(!strlen(sid)) {
		format(str, sizeof(str), "Your stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", PlayerInfo[playerid][Level], PlayerInfo[playerid][Kills], dini_Get(GetPlayerFile(playerid),"Tag"), PlayerInfo[playerid][Bank]);
		SendClientMessage(playerid, COLOR_GREEN , str);
    return 1; }
    id = ReturnID(sid);
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_BLUE, "Invalid PlayerID !");
    format(str, sizeof(str), "%s's stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", GetName(id), PlayerInfo[id][Level], PlayerInfo[id][Kills], dini_Get(GetPlayerFile(id),"Tag"), PlayerInfo[id][Bank]);
    SendClientMessage(playerid, COLOR_GREEN, str);
    return 1; }
Reply
#4

pawn Код:
if(!strcmp(cmd, "/stats", true))
{
    new sid[256], id;
    sid = strtok(cmdtext,idx);
    if(!strlen(sid))
    {
        format(str, sizeof(str), "Your stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", PlayerInfo[playerid][Level], PlayerInfo[playerid][Kills], dini_Get(GetPlayerFile(playerid),"Tag"), PlayerInfo[playerid][Bank]);
        SendClientMessage(playerid, COLOR_GREEN , str);
    return 1;
    }
    id = ReturnID(sid);
    if(!IsPlayerConnected(id) || id > MAX_PLAYERS) return SendClientMessage(playerid,COLOR_BLUE, "Invalid PlayerID !");
    format(str, sizeof(str), "%s's stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", GetName(id), PlayerInfo[id][Level], PlayerInfo[id][Kills], dini_Get(GetPlayerFile(id),"Tag"), PlayerInfo[id][Bank]);
    SendClientMessage(playerid, COLOR_GREEN, str);
    return 1;
}
Try that, change MAX_PLAYERS to the max player amount on your server, then test it
Reply
#5

Quote:
Originally Posted by lrZ^ aka LarzI
pawn Код:
if(!strcmp(cmd, "/stats", true))
{
    new sid[256], id;
    sid = strtok(cmdtext,idx);
    if(!strlen(sid))
    {
        format(str, sizeof(str), "Your stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", PlayerInfo[playerid][Level], PlayerInfo[playerid][Kills], dini_Get(GetPlayerFile(playerid),"Tag"), PlayerInfo[playerid][Bank]);
        SendClientMessage(playerid, COLOR_GREEN , str);
    return 1;
    }
    id = ReturnID(sid);
    if(!IsPlayerConnected(id) || id > MAX_PLAYERS) return SendClientMessage(playerid,COLOR_BLUE, "Invalid PlayerID !");
    format(str, sizeof(str), "%s's stats: Level: %d, Kills: %d, Tag: %s, Bank: $%d.", GetName(id), PlayerInfo[id][Level], PlayerInfo[id][Kills], dini_Get(GetPlayerFile(id),"Tag"), PlayerInfo[id][Bank]);
    SendClientMessage(playerid, COLOR_GREEN, str);
    return 1;
}
Try that, change MAX_PLAYERS to the max player amount on your server, then test it
ok i will try this tnx
Reply
#6

no it's not working
Reply
#7

Maybe the returnid function isn't working correctly?
Reply
#8

Put this at the top of OnPlayerCommandText, This way if they try to type a real long command then it makes them think the command is unknown
pawn Код:
if(strlen(cmdtext) >= max) // Replace max with the maximum amount of chars you want the player to be able to type
{
  return SendClientMessage(playerid, color, "SERVER: Unknown command"); // Replace color with white
}
Reply
#9

Quote:
Originally Posted by JeNkStAX
Put this at the top of OnPlayerCommandText, This way if they try to type a real long command then it makes them think the command is unknown
pawn Код:
if(strlen(cmdtext) >= max) // Replace max with the maximum amount of chars you want the player to be able to type
{
  return SendClientMessage(playerid, color, "SERVER: Unknown command"); // Replace color with white
}
i try it's didn't work

and how i change MAX_PLAYERS to the max player amount on my server

i try it's don't working
Reply
#10

Quote:
Originally Posted by The_Davil
Quote:
Originally Posted by JeNkStAX
Put this at the top of OnPlayerCommandText, This way if they try to type a real long command then it makes them think the command is unknown
pawn Код:
if(strlen(cmdtext) >= max) // Replace max with the maximum amount of chars you want the player to be able to type
{
  return SendClientMessage(playerid, color, "SERVER: Unknown command"); // Replace color with white
}
i try it's didn't work
It must work and it works perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)