ToX1c Posted April 5, 2011 Posted April 5, 2011 Salut cum fac si eu comanda /ban de ex eu dau cuiva ban acuma si vreau sa fac ca sa poata da peste 1 minut ban la altcineva..if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 3) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }
Flyer-Satyr Posted April 5, 2011 Posted April 5, 2011 http://wiki.sa-mp.com/wiki/SetTimerExpune un timer
TzAkS Posted April 6, 2011 Posted April 6, 2011 Incearca asa..facem o improvizatieComanda asta o am la /ad..new adds = 1; new addtimer = 60000 Tu ar trebuii sa pui ceva de genu if ((!adds) && (PlayerInfo[playerid][pAdmin] > 1)) { format(string, sizeof(string), " Textul tau..Ai dat deja ban..bla bla!", (addtimer/1000)); SendClientMessage(playerid, COLOR_GRAD2, string); return 1;Sper sa fie bine
ToX1c Posted April 6, 2011 Author Posted April 6, 2011 Mane am facut asa da nu merge ...tot pot sa dau ban..nu ma pune sa asteptif(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 3) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /bex [playerid/PartOfName] [reason]"); return 1; } if ((!banss) && (PlayerInfo[playerid][pAdmin] < 1)) { format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.", (addtimer/1000)); SendClientMessage(playerid, COLOR_GRAD2, string); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } new banss = 1000;
SaLiErY Posted April 6, 2011 Posted April 6, 2011 da iti arat eu o alta metoda dar si a lui tzaks e buna subnew UsedFind[MAX_PLAYERS]; adaugi new UsedBan[MAX_PLAYERS]; la onplayerconnect sub UsedFind[playerid] = 0; adaugi UsedBan[playerid] = 0; dupaia cauta fuctia if(UsedFind[i] >= 1) { UsedFind[i] += 1; if(UsedFind[i] >= 120) { UsedFind[i] = 0; } } adauga if(UsedBan[i] >= 1) { UsedBan[i] += 1; if(UsedBan[i] >= 120) { UsedBan[i] = 0; } } la comanda ta de ban adaugai fuctia if(UsedBan[playerid] != 0 && PlayerInfo[playerid][pAdmin] > 7) // aici daca ai adm mai mare de rank 7 poti da ban fara sa astepti { SendClientMessage(playerid, COLOR_WHITE, " You've already Ban , wait 2 minutes !"); return 1; }sper sa te ajute
TzAkS Posted April 6, 2011 Posted April 6, 2011 La cum am facut eu mai trebuie completat..da eu scriptez de 2 saptamani:))
SaLiErY Posted April 6, 2011 Posted April 6, 2011 La cum am facut eu mai trebuie completat..da eu scriptez de 2 saptamani:))omule stai lin ca nu to dat nimeni in cap ca nu stii imi unu imi pare bine ca teai bagat sa-l ajungi
ToX1c Posted April 6, 2011 Author Posted April 6, 2011 Mane am facut cum ai zis da nu merge..if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } if(UsedBan[playerid] != 0 && PlayerInfo[playerid][pAdmin] > 1338) { SendClientMessage(playerid, COLOR_WHITE, " You've already Ban , wait 2 minutes !"); return 1; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /bex [playerid/PartOfName] [reason]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); UsedBan[playerid] = 1; return 1; } }//not connected } else { format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }Mi-am dat admin 3 si am dat ban cuiva si dupa mie si am putut sa ma banez!!
SaLiErY Posted April 7, 2011 Posted April 7, 2011 uite incerca comanda asta inposibil sa nu merga http://pastebin.com/2RDBLuZfdaca nu merge anuntama asta o foloseam ca acuma am comanda de ban pe timp
TzAkS Posted April 7, 2011 Posted April 7, 2011 Nu mergea comanda aia nush de ce..trebuia sa mearga..eu am incercat`o pe alta comanda ca nu am cui sa ii dau ban
ToX1c Posted April 7, 2011 Author Posted April 7, 2011 Salut am facut si eu la comanda ban cand dai /ban la cineva si dupa aia la altul sa astepti 1 min si am facut sa apara secundele.. cat trebuie sa astepti sa dai /ban if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 2) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(UsedBan[playerid] != 0) { new bantime = PlayerInfo[playerid][pBanTime]; format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.", bantime); SendClientMessage(playerid, COLOR_1BLUE, string); return 1; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_WHITE,"You can ban yourself, stupid"); return 1; } if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) { SendClientMessage(playerid, COLOR_LIGHTRED,"You can't ban an admin with a higher level than you ! KICK !"); Kick(playerid); } new sendername8[24]; GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername8, sizeof(sendername8)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); UsedBan[playerid] = 1; return 1; } } }//not connected } return 1; } if(UsedBan[playerid] != 0) { new bantime = PlayerInfo[playerid][pBanTime]; format(string, sizeof(string), "Ai folosit deja comanda /ban incearca peste %d de secunde.", bantime); SendClientMessage(playerid, COLOR_1BLUE, string); return 1; }si nu merge imi apare 0 secunde...am facut tot ce trebuie
IstuntmanI Posted April 8, 2011 Posted April 8, 2011 Ma ajuta cineva?Te ajuta cei de aici: http://www.sa-mp.ro/forum/index.php/topic,5356.0.html
Question
ToX1c
Salut cum fac si eu comanda /ban de ex eu dau cuiva ban acuma si vreau sa fac ca sa poata da peste 1 minut ban la altcineva..
if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 3) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "UTILIZARE: /ban [playerid/PartOfName] [reason]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), "Aces player nu este conectat.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }14 answers to this question
Recommended Posts