29.06.2009, 20:18
Код:
if(strcmp(cmd, "/givebadge", true) == 0) { new para1; new level; para1 = ReturnUser(tmp); tmp = strtok(cmdtext, idx); level = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givebadge [playerid/PartOfName] [badge ID]"); return 1; } if (PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3) { //--------CHECK IF BADGE IS IN SQL---------------// new tmp2[256]; new playername2[MAX_PLAYER_NAME]; new query[256]; format(tmp2, sizeof(tmp2), "SELECT COUNT(*) FROM players WHERE LEOBadge='%s'", level); samp_mysql_query(tmp2); samp_mysql_store_result(); if(samp_mysql_fetch_row(query) != level) { new tmpbadge[64]; strmid(tmpbadge, tmp, 0, strlen(cmdtext), 255); //---------------------------------------------------------------------------------------// GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s grabs a badge and hands it to %s.", sendername, giveplayer ); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf(string); format(string, sizeof(string), "You have been given your badge by %s, your badge ID is: %s.", sendername, level); SendClientMessage(para1, COLOR_WHITE, string); format(string, sizeof(string), "You have given %s badge ID %s.", giveplayer, level); SendClientMessage(playerid, COLOR_YELLOW, string); //--------SAVE BADGE INTO SQL---------------// // new tmp2[256]; // new playername2[MAX_PLAYER_NAME]; GetPlayerName(para1, playername2, sizeof(playername2)); PlayerInfo[para1][pLEOBadge] = level; format(tmp2, sizeof(tmp2), "SELECT COUNT(*) FROM players WHERE Name='%s'", playername2); samp_mysql_query(tmp2); samp_mysql_store_result(); samp_mysql_fetch_row(tmp2); format(tmp2, sizeof(tmp2), "INSERT INTO players (LEOBadge) VALUES ('%s')", PlayerInfo[para1][pLEOBadge]); samp_mysql_query(tmp2); //----------------------------------------// OnUpdatePlayer(para1); return 1; } else if(samp_mysql_fetch_row(query) == level) { samp_mysql_free_result(); return SendClientMessage(playerid, COLOR_RED, "Another LEO already occupies this badge number!"); } } else { return SendClientMessage(playerid, COLOR_GRAD1, "You are not a Civil Faction leader!"); } }
Quote:
This code was not stolen from anywhere. Next time, before locking my thread, check to see if the code even exists, because the base script which I use, which is CW-RP, doesn't contain this code in it at all. Not even the SQL column exists within CW-RP's main SQL structure. This script is unrelated to any gamemode, because I will and can use it on any script I like. Therefore, I've made my point. If you still feel this thread does not belong here, don't lock the thread. Delete it, for it will be a problem and an exposure to the public on my development. |