05.02.2011, 12:56
here is my code to set the org colour:
to set colour:
loading part:
the thing is the hex code gets stored in my sql and it loads with 0xcode but when i use setplayercolor it sets the colour to black. help please
Код:
CMD:ocolour(playerid, params[]) { new id,colour[64], query[128]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "You cannot use this command."); if(sscanf(params,"is",id,colour)) return SendClientMessage(playerid, red, "USAGE:/ocolour [id] [colour]"); format(query, sizeof(query), "UPDATE orgs SET Colour='%s' WHERE ID=%d",colour,id); mysql_query(query); return 1; }
Код:
CMD:oskin(playerid, params[]) { SetPlayerColor(playerid, ocolour[playerid]); SetPlayerSkin(playerid, oskin[playerid] & oskin1[playerid] & oskin2[playerid]); return 1; }
Код:
LoadOstats(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); new query[128]; format(query, sizeof(query), "SELECT * FROM ostats WHERE name='%s'", name); mysql_query(query); mysql_store_result(); new row[128]; new field[13][32]; mysql_fetch_row_format(row, "|"); explode(row, field, "|"); org[playerid] =strval(field[1]); leader[playerid]=strval(field[3]); req[playerid]=strval(field[2]); mysql_free_result(); new string[128]; format(string, sizeof(string), "SELECT * FROM orgs WHERE ID=%d", org[playerid]); mysql_query(string); mysql_store_result(); mysql_fetch_row_format(row, "|"); explode(row, field, "|"); format(oname[playerid], 32, "%s", field[1]); format(ocolour[playerid], 32, "%s", field[2]); otype[playerid]=strval(field[3]); oskin[playerid]=strval(field[4]); oskin1[playerid]=strval(field[5]); oskin2[playerid]=strval(field[6]); mysql_free_result(); return 1; }