30.12.2014, 06:16
It looks like dini?
But I would like to use zcmd aswell.
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(setaccent, 9, cmdtext); dcmd(deleteaccount, 13, cmdtext); dcmd(duel, 4, cmdtext); dcmd(setbankreload, 13, cmdtext); dcmd(subf, 4, cmdtext); dcmd(mass, 4, cmdtext); dcmd(assigncommander, 15, cmdtext); dcmd(givedonuts, 10, cmdtext); dcmd(givedonutstoall, 15, cmdtext); //dcmd(exchange, 8, cmdtext); dcmd(removedonuts, 12, cmdtext); if(gPlayerSpawned[playerid] == 0) { SendClientMessage(playerid, COLOR_GRAD1, " You are not logged in or have not spawned !"); return 1; } new string[128]; new sendername[MAX_PLAYER_NAME]; new giveplayer[MAX_PLAYER_NAME]; new cmd[128]; new tmp[128]; new rapstyle; new wankstyle; new dancestyle; new sexstyle; new bjstyle; new giveplayerid, moneys, idx; cmd = strtok(cmdtext, idx); if(strcmp(cmd,"/mute",true,4) && strcmp(cmd, "/report",true,6) && PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted."); //=========================[Anti-server advertisement]========================== new dotcount =0; new dotcount2 =0; new coloncount =0; new slashcount =0; new numcount =0; new numcount2 =0; new numcount3 =0; new numcount4 =0; new numcount5 =0; new numcount6 =0; new numcount7 =0; new numcount8 =0; new numcount9 =0; new numcount10 =0; for(new a=1; a <strlen(cmdtext); a++) { if(cmdtext[a] == ':') { coloncount ++; } else if(cmdtext[a] == '.') { dotcount ++; } else if(cmdtext[a] == ',') { dotcount2 ++; } else if(cmdtext[a] == '/') { slashcount ++; } else if(cmdtext[a] == '0') { numcount ++; } else if(cmdtext[a] == '1') { numcount2 ++; } else if(cmdtext[a] == '2') { numcount3 ++; } else if(cmdtext[a] == '3') { numcount4 ++; } else if(cmdtext[a] == '4') { numcount5 ++; } else if(cmdtext[a] == '5') { numcount6 ++; } else if(cmdtext[a] == '6') { numcount7 ++; } else if(cmdtext[a] == '7') { numcount8 ++; } else if(cmdtext[a] == '8') { numcount9 ++; } else if(cmdtext[a] == '9') { numcount10 ++; } } if(dotcount >= 3 && coloncount == 1 && PlayerInfo[playerid][pAdmin] < 3 && (numcount > 0 || numcount2 > 0 || numcount3 > 0 || numcount4 > 0 || numcount5 > 0 || numcount6 > 0 || numcount7 > 0 || numcount8 > 0 || numcount9 > 0 || numcount10 > 0)) { format(string, sizeof(string), "Possible server advertisment: [%d]%s",playerid,PlayerName(playerid)); ABroadCast(COLOR_YELLOW,string,1); format(string, sizeof(string), "Message: %s",cmdtext); ABroadCast(COLOR_LIGHTBLUE,string,1); new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); new logstring[256]; new year, month, day; getdate(year, month, day); format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Text: %s.", ip, day, month, year,PlayerName(playerid),cmdtext); AdLog(logstring); SendClientMessage(playerid, COLOR_LIGHTRED, "You are not allowed to advertise other servers here."); return 1; } if(dotcount2 == 3 && coloncount == 1 && PlayerInfo[playerid][pAdmin] < 3 && (numcount > 0 || numcount2 > 0 || numcount3 > 0 || numcount4 > 0 || numcount5 > 0 || numcount6 > 0 || numcount7 > 0 || numcount8 > 0 || numcount9 > 0 || numcount10 > 0)) { format(string, sizeof(string), "Possible server advertisment: [%d]%s",playerid,PlayerName(playerid)); ABroadCast(COLOR_YELLOW,string,1); format(string, sizeof(string), "Message: %s",cmdtext); ABroadCast(COLOR_LIGHTBLUE,string,1); new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); new logstring[256]; new year, month, day; getdate(year, month, day); format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Text: %s.", ip, day, month, year,PlayerName(playerid),cmdtext); AdLog(logstring); SendClientMessage(playerid, COLOR_LIGHTRED, "You are not allowed to advertise other servers here."); return 1; } if(slashcount == 3 && coloncount == 1 && PlayerInfo[playerid][pAdmin] < 3 && (numcount > 0 || numcount2 > 0 || numcount3 > 0 || numcount4 > 0 || numcount5 > 0 || numcount6 > 0 || numcount7 > 0 || numcount8 > 0 || numcount9 > 0 || numcount10 > 0)) { format(string, sizeof(string), "Possible server advertisment: [%d]%s",playerid,PlayerName(playerid)); ABroadCast(COLOR_YELLOW,string,1); format(string, sizeof(string), "Message: %s",cmdtext); ABroadCast(COLOR_LIGHTBLUE,string,1); new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); new logstring[256]; new year, month, day; getdate(year, month, day); format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Text: %s.", ip, day, month, year,PlayerName(playerid),cmdtext); AdLog(logstring); SendClientMessage(playerid, COLOR_LIGHTRED, "You are not allowed to advertise other servers here."); return 1; } if(slashcount == 4 && PlayerInfo[playerid][pAdmin] < 3 && (numcount > 0 || numcount2 > 0 || numcount3 > 0 || numcount4 > 0 || numcount5 > 0 || numcount6 > 0 || numcount7 > 0 || numcount8 > 0 || numcount9 > 0 || numcount10 > 0)) { format(string, sizeof(string), "Possible server advertisment: [%d]%s",playerid,PlayerName(playerid)); ABroadCast(COLOR_YELLOW,string,1); format(string, sizeof(string), "Message: %s",cmdtext); ABroadCast(COLOR_LIGHTBLUE,string,1); new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); new logstring[256]; new year, month, day; getdate(year, month, day); format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Text: %s.", ip, day, month, year,PlayerName(playerid),cmdtext); AdLog(logstring); SendClientMessage(playerid, COLOR_LIGHTRED, "You are not allowed to advertise other servers here."); return 1; } if(gPlayerLogged[playerid] == 1) { GetPlayerNameEx(playerid, sendername, sizeof(sendername)); printf("[cmd] [%s] %s", sendername, cmdtext); } if(strcmp(cmd, "/pay", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } moneys = strvalEx(tmp); if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GRAD1, " You must be level 2 to pay more than $1000 at a time !"); return 1; } if(moneys < 1 || moneys > 100000) { SendClientMessage(playerid, COLOR_GRAD1, " You can't pay more under $1 or than $100,000 at a time !"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't pay money to yourself !"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { if(ProxDetectorS(5.0, playerid, giveplayerid)) { GetPlayerNameEx(playerid, sendername, sizeof(sendername)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); new playermoney = PlayerInfo[playerid][pCash]; if(moneys > 0 && playermoney >= moneys) { PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, (0 - moneys)); PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys; GivePlayerMoney(giveplayerid, moneys); if(PlayerInfo[playerid][pMask] > 0){ sendername = "Stranger"; } if(PlayerInfo[giveplayerid][pMask] > 0){ giveplayer = "Stranger"; } format(string, sizeof(string), " You have paid $%d to %s",moneys,giveplayer); SendClientMessage(playerid, COLOR_GRAD1, string); format(string, sizeof(string), " You have recieved $%d from %s.", moneys,sendername); SendClientMessage(giveplayerid, COLOR_GRAD1, string); format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.",sendername,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); new plrIP[16]; new giveplrIP[16]; GetPlayerIp(playerid, plrIP, sizeof(plrIP)); GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP)); format(string, sizeof(string), "%s (IP:%s) (Key:%s) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%s)", sendername,plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,giveplayer,giveplrIP,PlayerInfo[giveplayerid][pKey]); PayLog(string); } else { SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount !"); } } else { SendClientMessage(playerid, COLOR_GRAD1, " You're too far away !"); } } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } if(strcmp(cmd, "/charity", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /charity [amount]"); return 1; } moneys = strvalEx(tmp); if(moneys < 0) { SendClientMessage(playerid, COLOR_GRAD1, " That is not enough !"); return 1; } if(PlayerInfo[playerid][pCash] < moneys) { SendClientMessage(playerid, COLOR_GRAD1, " You don't have that much money !"); return 1; } PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, -moneys); GetPlayerNameEx(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s Thank you for you donation of $%d.",sendername, moneys); SendClientMessage(playerid, COLOR_GRAD1, string); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PayLog(string); } return 1; } if(strcmp(cmd, "/stats", true) == 0) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] != 0) { ShowStats(playerid,playerid); } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not Logged in !"); } } return 1; }