Mysql problem [FIXED]
#1

EDIT: I FIXED IT!













pawn Код:
CMD:setleader(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"ui",ID,orgid)) return SendClientMessage(playerid,grey,"USAGE: /setleader [playerid / partofname] [orgid]");
    if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: That user is not connected.");
    if(PlayerInfo[ID][Member] != -255) return SendClientMessage(playerid,red,"You can't set a leader that is in an organization.");
    GetPlayerName(ID,pname,sizeof(pname));
    GetPlayerName(playerid,Nam,sizeof(Nam));
    CheckMySQL();
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        format(str,sizeof(str),"Administrator %s has set you the leader of (orgid: %d).",Nam,orgid);
        SendClientMessage(ID,orange,str);
        format(str,sizeof(str),"You have set %s the organization leader of (orgid: %d).",pname,orgid);
        SendClientMessage(playerid,orange,str);
        PlayerInfo[ID][Member] = orgid;
        PlayerInfo[ID][Genre] = strval(field[2]);
        PlayerInfo[ID][Leader] = 1;
        ResetPlayerWeapons(ID);
        mysql_free_result();
        format(str,sizeof(str),"UPDATE orgs SET Leader = '%s' WHERE Orgid = '%d'",pname,orgid);
        mysql_query(str);
    }
    else if(mysql_num_rows() == 0)
    {
        SendClientMessage(playerid,red,"ERROR: This Organization ID is not available.");
    }
    request[ID] = -255;
      return 1;
}
Well the problem is when i do setleader [playerid] [random org id] it sets the player that orgid while its not created in my mysql file
Reply


Messages In This Thread
Mysql problem [FIXED] - by Tanush123 - 15.12.2011, 20:43

Forum Jump:


Users browsing this thread: 1 Guest(s)