09.10.2013, 21:27
I am working on my gamemode from the scratch and i am using y_commands. I have a lot of commands but some does not work properly. I am coding all commands the same so i dont know what problem is. Whatever, when i write for example (/s)hout text, it returns like i did not enter text: "Usage: /s [text]" and over and over. What should i do? Its same for the /kick , /ban ... it always returns how should i use it no matter if i enter paramaters or not.
Few commands that aren't working:
Hope you will help me! Thanks in forward and sorry if i made a grammar mistake
Few commands that aren't working:
Код:
YCMD:s(playerid, params[], help) { #pragma unused help new sendername[MAX_PLAYER_NAME]; new string[128]; new text[128]; if(sscanf(params,"s[128]",text)) return SCM(playerid,-1,"Koriscenje: /s [text]"); GetPlayerName(playerid, sendername, sizeof(sendername)); new brojevi[] = { '1','2','3','4','5','6','7','8','9'}; for(new b = 0; b < sizeof brojevi; b++) { new tekst = strlen(text); for(new i = 0; i<tekst; i++) { if(text[i] == brojevi[b]) text[i] = '*' ; } } if(PlayerInfo[playerid][pMute] == 1) { SendClientMessage(playerid, -1, "Ne mozete pricati, oduzeto vam je pravo govora !"); } else { format(string, sizeof(string), "%s vice: %s!!!", sendername, text); ProxDetector(30.0, playerid, string,-1,-1,-1,-1,-1); } printf("%s", string); return 1; }
Код:
YCMD:me(playerid, params[], help) { #pragma unused help new sendername[MAX_PLAYER_NAME]; new result[128]; new string[128]; GetPlayerName(playerid, sendername, sizeof(sendername)); if(sscanf(params,"s[128]",result)) return SCM(playerid, COL_GREY, "Koristite: /me [akcija]"); format(string, sizeof(string), "* %s %s", sendername, result); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf("%s", string); return 1; }
Код:
YCMD:vesti(playerid, params[], help) { #pragma unused help #pragma unused params new string[256],vesti[128]; if(PlayerInfo[playerid][pOrg] != 10) return SCM(playerid, COL_GREY, "Niste u RADIO MONACO!"); if(GetPlayerVehicleID(playerid) != RadioVozilo[0] && GetPlayerVehicleID(playerid) != RadioVozilo[1] && GetPlayerVehicleID(playerid) != RadioVozilo[2] && GetPlayerVehicleID(playerid) != RadioVozilo[3] && GetPlayerVehicleID(playerid) != RadioVozilo[4] && GetPlayerVehicleID(playerid) != RadioVozilo[5] && GetPlayerVehicleID(playerid) != RadioVozilo[6] && GetPlayerVehicleID(playerid) != RadioVozilo[7] && GetPlayerVehicleID(playerid) != RadioVozilo[8]) { SCM(playerid, COL_GREY, "Niste u vozilu Radio M-a!"); return 1; } if(!sscanf(params,"s[128]",vesti)) { format(string,sizeof(string),""CRVENA"[RADIO M] Vesti | Voditelj {FFFFFF}%s: %s", GetName(playerid), vesti); SendClientMessageToAll(-1, string); } else { SCM(playerid, COL_GREY, "Koristite: /vesti [text vesti]"); } return 1; }
Код:
YCMD:ban(playerid, params[], help) { #pragma unused help new id,razlog[48],string[128]; if(PlayerInfo[playerid][pAdminLevel] == 0) return SCM(playerid,COL_GREY,"Nemate dovoljan admin level"); if(sscanf(params,"us[48]",id,razlog)) return SCM(playerid,COLOR_RED,"Uputstvo: "COL_WHITE"/ban [ID igraca/Deo Imena] [Razlog]"); if(id == INVALID_PLAYER_ID) return SCM(playerid,COLOR_RED,"Uputstvo: "COL_WHITE"Pogresan ID igraca"); new pFile[35]; format(pFile, 35, Ban_File, GetName(id)); if(fexist(pFile)) return SCM(playerid,COLOR_RED,"Greska: "COL_WHITE"Igrac je vec banovan"); new INI:UserFile = INI_Open(pFile); INI_WriteString(UserFile, "BanBy", GetName(playerid)); INI_WriteString(UserFile, "Razlog", razlog); INI_Close(UserFile); format(string,128,"Admin "COL_WHITE"%s "COL_RED"je banovao "COL_WHITE"%s"COL_RED". Razlog: "COL_WHITE"%s",GetName(playerid),GetName(id),razlog); SendClientMessageToAll(COLOR_RED,string); Kick(id); return 1; }
Код:
YCMD:kick(playerid, params[], help) { #pragma unused help new id,razlog[48],string[128]; if(PlayerInfo[playerid][pAdminLevel] == 0) return SCM(playerid,COL_GREY, "Nemate dovoljan admin level"); if(sscanf(params,"us[48]",id,razlog)) return SCM(playerid,COLOR_RED,"Uputstvo: "COL_WHITE"/kick [ID igraca/Deo Imena] [Razlog]"); if(id == INVALID_PLAYER_ID) return SCM(playerid,COLOR_RED,"Uputstvo: "COL_WHITE"Pogresan ID igraca"); format(string,128,"Admin "COL_WHITE"%s "COL_RED"je kikovao "COL_WHITE"%s"COL_RED". Razlog: "COL_WHITE"%s",GetName(playerid),GetName(id)); SendClientMessageToAll(COLOR_RED,string); Kick(id); return 1; }