20.06.2011, 18:35
I'm a noob scripter, been doing it a week, and the other scripter asked me to set a command that actually sets the players skin to the one defined in Mysql. However, I dont know how to use MYSQL in scripting so could someone give me the code or tell me how to do it in this case:
Код:
CMD:fskin(playerid, params[]) { if(playerVariables[playerid][pFaction] >= 1 && playerVariables[playerid][pFactionRank] >= 6) { new skinID[32], rankID; if(sscanf(params, "ds[32]", rankID, skinID)) { return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/fskin [rankid (1-6)] [skin id]"); } else { new messageString[128], skin[128]; switch(rankID) { case 1: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin1]); format(messageString, sizeof(messageString), "You have changed the skim of Rank 1 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); } case 2: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin2]); format(messageString, sizeof(messageString), "You have changed the skin of Rank 2 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); } case 3: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin3]); format(messageString, sizeof(messageString), "You have changed the skin of Rank 3 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); } case 4: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin4]); format(messageString, sizeof(messageString), "You have changed the skin of Rank 4 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); } case 5: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin5]); format(messageString, sizeof(messageString), "You have changed the skin of Rank 5 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); } case 6: { mysql_real_escape_string(skinID, FVariables[playerVariables[playerid][pFaction]][gFactionSkin6]); format(messageString, sizeof(messageString), "You have changed the skin of Rank 6 to '%s'.", skinID); SendClientMessage(playerid, COLOR_WHITE, messageString); format(skin, sizeof(skin), "%s %s", GetName(playerid), skinID); } } } } return 1; }