Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:setfreq(playerid, params[]) {
- new string[256],password[20],password2[20],ownerid, sendername[25];
- if(PlayerInfo[playerid][pWTalkie] == 0) return SCM(playerid, COLOR_WHITE, "You don't have a walkie talkie.");
- new freqss2;
- if(sscanf(params, "dS(q)[20]",freqss2,password)) return SCM(playerid, COLOR_WHITE, "{dd0808}Syntax:{FFFFFF} /setfrequency [frequency] (0 to switch off).");
- if(freqss2 < 0 || freqss2 > 1000000) return SCM(playerid, COLOR_WHITE, "Invalid frequency specified. Valid frequencies: 1 - 1000000.");
- if(freqss2 == 0)
- {
- WTChannel[playerid] = 0;
- mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
- mysql_tquery(SQL,string,"","");
- SendClientMessage(playerid, COLOR_WHITE, "You have switched off your walkie-talkie.");
- return 1;
- }
- if(freqss2 < 100) return SCM(playerid, COLOR_WHITE, "Invalid walkie talkie frequency.");
- if(freqss2 >= 1000)
- {
- format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
- SCM(playerid, COLOR_WHITE, string);
- WTChannel[playerid] = freqss2;
- mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
- mysql_tquery(SQL,string,"","");
- }
- else
- {
- format(string, sizeof(string), "SELECT * FROM `frequencies` WHERE `freqid`='%d'", freqss2);
- new Cache: ab = mysql_query(SQL, string);
- if(cache_get_row_count() > 0)
- {
- cache_get_field_content(0, "password", password2);
- ownerid = cache_get_field_content_int(0, "ownerid");
- }
- else
- {
- cache_delete(ab);
- SendClientMessage(playerid, COLOR_WHITE, "Invalid frequency. This frequency can be bought from the /shop.");
- return 1;
- }
- cache_delete(ab);
- if(ownerid == PlayerInfo[playerid][pSQLID])
- {
- format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
- SCM(playerid, COLOR_WHITE, string);
- WTChannel[playerid] = freqss2;
- mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
- mysql_tquery(SQL,string,"","");
- }
- else
- {
- if(strcmp(password,password2,true) == 0)
- {
- format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
- SCM(playerid, COLOR_WHITE, string);
- WTChannel[playerid] = freqss2;
- mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
- mysql_tquery(SQL,string,"","");
- GetPlayerName(playerid,sendername,sizeof(sendername));
- foreach(Player, i) {
- if(WTChannel[i] == WTChannel[playerid]) {
- format(string, sizeof(string), "%s a intrat pe frecventa.",sendername);
- SCM(i, 0xC8E0DFFF, string);
- }
- }
- }
- else return SCM(playerid, COLOR_WHITE, "Invalid password! This is a private frequency. You need the password to enter.");
- }
- }
- return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement