Crashing problem
#1

This is pretty strange, when i use /setleader while im only spawned and logged in (it doesnt crash my volt host, ID 2). But when my friend spawns (ID 0) and i use it, the server just crashes

pawn Code:
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();
    format(str,sizeof(str),"SELECT * FROM orgs WHERE Orgid = %d",orgid);
    mysql_query(str);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        mysql_free_result();
        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);
        format(str, sizeof(str), "SELECT Wep1 FROM orgs WHERE Orgid = %d",orgid);
        mysql_query(str);
        mysql_store_result();
        weap1 = mysql_fetch_int();
        mysql_free_result();
        format(str, sizeof(str), "SELECT Wep2 FROM orgs WHERE Orgid = %d",orgid);
        mysql_query(str);
        mysql_store_result();
        weap2 = mysql_fetch_int();
        format(str, sizeof(str), "SELECT Wep3 FROM orgs WHERE Orgid = %d",orgid);
        mysql_query(str);
        mysql_store_result();
        weap3 = mysql_fetch_int();
        mysql_free_result();
        format(str, sizeof(str), "SELECT Hex FROM orgs WHERE Orgid = %d",orgid);
        mysql_query(str);
        mysql_store_result();
        ohex = mysql_fetch_int();
        mysql_free_result();
        format(str,sizeof(str),"UPDATE orgs SET Members = Members + 1 WHERE Orgid = %d",orgid);
        mysql_query(str);
        SetPlayerColor(ID,ohex);
        GivePlayerWeapon(ID,weap1,5000);
        GivePlayerWeapon(ID,weap2,5000);
        GivePlayerWeapon(ID,weap3,5000);
        format(str,sizeof(str),"UPDATE orgs SET Leader = '%s' WHERE Orgid = '%d'",pname,orgid);
        mysql_query(str);
    }
    else
    {
        SendClientMessage(playerid,red,"ERROR: This Organization ID is not available.");
    }
    request[ID] = -255;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)