Wysłany: 2013-05-18, 18:11
akon823
Czekotubka :D
Wiek: 29 Na forum: 4816 dni Posty: 399
Nick w MP: Remik14
Piwa : 152
Witam ;]
Mam komend? na zmian? pogody , lecz za ka?dym razem gdy wpisuje komend? to wyskakuje mi ''/pogoda [id pogody]'' i pogoda si? nie zmienia chocia? id jest prawid?owe...
By? mo?e kod jest z?y .
Kod: CMD:pogoda(playerid, params[])
{
new gWorldStatus[3] = {12, 4};
new tmp[256];
new string[256];
new Ranga = gGracz[playerid][RangaAdmina];
if(Ranga >= 6 || IsPlayerVIP(playerid))
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "/pogoda [id pogody]");
return 1;
}
new weat;
weat = strval(tmp);
if (weat < 0 || weat > 46)
{
SendClientMessage(playerid, COLOR_ADMIN, "Z?e ID pogody");
return true;
}
gWorldStatus[1] = weat;
SetWeather(weat);
format(string, 128, "Zmieni?e? pogode na: %d", weat);
SendClientMessage(playerid, COLOR_GREEN, string);
return true;
}
Prosi?bym o wyt?umaczenie abym wiedzia? co ?le robie
Za pomoc daje piwka
Wysłany: 2013-05-18, 18:12
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
akon823 , Zobacz tak:
Kod: if(strcmp(cmd, "/pogoda", true) == 0) {
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, CZ, "Nie jeste? Administratorem !");
new string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "SERVER: /pogoda [id pogody]");
return 1;
}
new pogoda;
pogoda = strval(tmp);
if (pogoda < 0 || pogoda > 46) {
SendClientMessage(playerid, CZERWONY, "AS: Z?e ID pogody");
return 1;
}
new gWorldStatus[3] = {12, 4};
gWorldStatus[1] = pogoda;
SetWeather(pogoda);
format(string, 128, "Administrator %s(ID:%s) zmieni? pogod? na %d",PlayerName(playerid), playerid, pogoda);
SendClientMessageToAll(POMARANCZOWY, string);
return 1;
}
Pozdrawiam
Wysłany: 2013-05-18, 18:26
akon823
Czekotubka :D
Wiek: 29 Na forum: 4816 dni Posty: 399
Nick w MP: Remik14
Piwa : 152
Tym razem mam ca?y czas "Nie jeste? Administratorem"
Dodam , ?e pisze w systemie zcmd i by?oby fajnie jakby od razu by?o w zcmd i chce aby Nie tylko rcon mogl zmieniac pogode wi?c zamiast "IsPlayerAdmin" prosi?bym to Kod: new Ranga = gGracz[playerid][RangaAdmina];
if(Ranga >= 6 || IsPlayerVIP(playerid))
Wysłany: 2013-05-18, 18:43
IgrexolonO
Wiek: 34 Na forum: 6809 dni Posty: 1386
Piwa : 1062
Skoro ju? u?ywasz zcmd, to zacznij u?ywa? te? sscanfa..
Kod: CMD:pogoda(playerid, params[])
{
if(Ranga >= 6 || IsPlayerVIP(playerid))
{
new weather;
if(sscanf(params, "d", weather)) return SendClientMessage(playerid, -1, "/pogoda [id pogodynki z polsatu]"), true;
if(weather < 0 || weather > 46) return SendClientMessage(playerid, COLOR_ADMIN, "Z?e ID pogody"), true;
gWorldStatus[1] = weather;
SetWeather(weather);
new stringah[30];
format(stringah, sizeof(stringah), "Zmieni?e? pogode na: %d", weather);
SendClientMessage(playerid, COLOR_GREEN, stringah);
} else SendClientMessage(playerid, -1, "Nie posiadasz odpowiedniej rangi!");
return true;
}
Wysłany: 2013-05-18, 23:10
akon823
Czekotubka :D
Wiek: 29 Na forum: 4816 dni Posty: 399
Nick w MP: Remik14
Piwa : 152
Dobra ju? wszystko ogarn??em dzi?ki wielkie pozdrawiam :>
Tagi: komenda
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: