ANy help I dont know this mean
#2

Here is a explanation.

pawn Код:
dcmd_changemode(playerid, params[]) // Command using DCMD.
{
    if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 2){ // If the player is A: Logged into rcon or 2: Level 3 Admin+ in-game
        new idx,gamemode,tmp[256],string[128]; // Local varible defines.
        tmp = strtok(params, idx);
        if(!strlen(tmp)) // If the String length is too short(Syntax is not correct) It sends the message below.
        {
            SendClientMessage(playerid, COLOR_ERROR, "USAGE: /changemode (gamemode) - Enter A Number 1 - 3");
            return 1;
        }
        if(!isNumeric(tmp))// If you use a Letter instead of a number, the following is sent.
        {
            SendClientMessage(playerid, COLOR_ERROR, "Invalid Gamemode Please Use A Numeric Character.");
            return 1;
        }
        gamemode = strval(tmp); // Gamemode = the  String Value inputed.
        if(gamemode < 1 || gamemode > 3) // String value can't be less then 1, or greater then 3
        {
            SendClientMessage(playerid, COLOR_ERROR, "Invalid Gamemode Please Enter A Number 1 - 3.");
            return 1;
        }
        for(new i = 0; i < GetMaxPlayers(); i++) // Instead of playerid, it uses i, to loop through all players.
        {
            if(IsPlayerConnected(i)) // Seeing if the playerid is Connected.
            {
                //SendClientMessage(i,COLOR_SERVER_HELP_MSG, "The Week is Over! - Please Reconnect.");
                PlayerInfo[i][pSpawn] = 0;
                //Kick(i);
            }
        }
        switch (gamemode) // The String Value, which was entered earlier.
        {
            case 1: // If 1 is entered, then Change to Los Santos.
            {
                format(string, sizeof(string), "{FFFFFF}Game Mode Changed: {BDBDBD}Los Santos");
            }
            case 2: // If 2 was entered, then change to Las Venturas
            {
                format(string, sizeof(string), "{FFFFFF}Game Mode Changed: {BDBDBD}Las Venturas");
            }
            case 3: // If 3 was entered, change to San Fierro.
            {
                format(string, sizeof(string), "{FFFFFF}Game Mode Changed: {BDBDBD}San Fierro");
            }
        }
        SendClientMessage(playerid,COLOR_SERVER_MAIN_MSG, string);
        // Updates 'Server' and sets 'Gamemode' to the value inputed, at 'Server' through the SQL database.
        format(string, sizeof(string), "UPDATE server SET Gamemode = '%d' WHERE Server = '2'",gamemode);
        mysql_query(string); // Query's the SQL
        GameTextForAll("~b~THE WEEK IS OVER!~n~~w~CHANGING CITIES", 5000, 3);
        SendClientMessageToAll(COLOR_SERVER_MAIN_MSG, "{FFFFFF}The Week is Over! - {FF0000}Changing Cities");
        SendRconCommand("gmx"); // Restarts the server, once the new Gamemode is set.
    }else{
        SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
    }
    return 1;
}
Reply


Messages In This Thread
ANy help I dont know this mean - by NNek - 27.06.2014, 06:14
Re: ANy help I dont know this mean - by Lynn - 27.06.2014, 06:29
Re: ANy help I dont know this mean - by NNek - 27.06.2014, 06:36
Re: ANy help I dont know this mean - by yvoms - 27.06.2014, 06:46
Re: ANy help I dont know this mean - by NNek - 27.06.2014, 06:49
Re: ANy help I dont know this mean - by NNek - 27.06.2014, 14:52

Forum Jump:


Users browsing this thread: 1 Guest(s)