Započeo [GU:RP] Ivica
•14. Feb. 2013.• Zaključano[Pomoc] iz strcmp u zcmd
462
pregleda
13
postova
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
14. Feb. 2013.
Skripta koju koristim:cyber
Detaljan opis problema:kako prebacit ovu cmd iz strcmp u zcmd sa sscanfom
Dio skripte:evo komande
Neke slike/video za lakse dobivanje pomoci(neobavezno):
Detaljan opis problema:kako prebacit ovu cmd iz strcmp u zcmd sa sscanfom
Dio skripte:evo komande
if(strcmp(cmd,"/materials",true)==0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo != 9)
{
SendClientMessage(playerid,SIVA,"Niste Diler Oruzja!");
return 1;
}
new x_nr;
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, BELA, "{FFAF00}Koristite: {FFFFFF} /materials ");
SendClientMessage(playerid, BELA, "Dostupna imena: Get, Deliver.");
return 1;
}
if(strcmp(x_nr,"get",true) == 0)
{
if(PlayerToPoint(3.0,playerid,597.1277,-1248.6479,18.2734))
{
if(MatsHolding >= 10)
{
SendClientMessage(playerid, SIVA, "Mozete nositi samo deset paketa!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, BELA, "{FFAF00}Koristite: {FFFFFF} /materials get ");
return 1;
}
moneys = strvalEx(tmp);
if(moneys < 1 || moneys > 10) { SendClientMessage(playerid, SIVA, "Broj paketa ne moze biti manji od 1, a veci od 10!"); return 1; }
new price = moneys * 100;
if(GetPlayerMoney(playerid) > price)
{
format(string, sizeof(string), "*Kupili ste %d paketa materijala za $%d.", moneys, price);
SendClientMessage(playerid, SVETLOPLAVA, string);
GivePlayerMoney(playerid, - price);
MatsHolding = moneys;
}
else
{
format(string, sizeof(string), "You can't afford the $%d !", price);
SendClientMessage(playerid, SIVA, string);
}
}
else
{
SendClientMessage(playerid, SIVA, "Ne nalazite se u tvornici materijala!");
return 1;
}
}
else if(strcmp(x_nr,"deliver",true) == 0)
{
if(PlayerToPoint(3.0,playerid,960.8097,2098.9685,1011.0243))
{
if(MatsHolding > 0)
{
new payout = (50)*(MatsHolding);
format(string, sizeof(string), "* Tvornica ti je dala %d materijala za %d materijala paketa.", payout, MatsHolding);
SendClientMessage(playerid, SVETLOPLAVA, string);
PlayerInfo += payout;
MatsHolding = 0;
}
else
{
SendClientMessage(playerid, SIVA, "Nemate materijale !");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, "Niste u tvornici materijala!");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, " Invalid Materials Name !");
return 1;
}
}
return 1;
}Neke slike/video za lakse dobivanje pomoci(neobavezno):
Kingpin
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
1,112
Postovi:
192
Teme:
Pridružio se:Feb. 2012
14. Feb. 2013.
CMD:materials(playerid,parmas[])
{
if (PlayerInfo != 9)
{
SendClientMessage(playerid,SIVA,"Niste Diler Oruzja!");
return 1;
}
new x_nr;
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, BELA, "{FFAF00}Koristite: {FFFFFF} /materials ");
SendClientMessage(playerid, BELA, "Dostupna imena: Get, Deliver.");
return 1;
}
if(strcmp(x_nr,"get",true) == 0)
{
if(PlayerToPoint(3.0,playerid,597.1277,-1248.6479,18.2734))
{
if(MatsHolding >= 10)
{
SendClientMessage(playerid, SIVA, "Mozete nositi samo deset paketa!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, BELA, "{FFAF00}Koristite: {FFFFFF} /materials get ");
return 1;
}
moneys = strvalEx(tmp);
if(moneys < 1 || moneys > 10) { SendClientMessage(playerid, SIVA, "Broj paketa ne moze biti manji od 1, a veci od 10!"); return 1; }
new price = moneys * 100;
if(GetPlayerMoney(playerid) > price)
{
format(string, sizeof(string), "*Kupili ste %d paketa materijala za $%d.", moneys, price);
SendClientMessage(playerid, SVETLOPLAVA, string);
GivePlayerMoney(playerid, - price);
MatsHolding = moneys;
}
else
{
format(string, sizeof(string), "You can't afford the $%d !", price);
SendClientMessage(playerid, SIVA, string);
}
}
else
{
SendClientMessage(playerid, SIVA, "Ne nalazite se u tvornici materijala!");
return 1;
}
}
else if(strcmp(x_nr,"deliver",true) == 0)
{
if(PlayerToPoint(3.0,playerid,960.8097,2098.9685,1011.0243))
{
if(MatsHolding > 0)
{
new payout = (50)*(MatsHolding);
format(string, sizeof(string), "* Tvornica ti je dala %d materijala za %d materijala paketa.", payout, MatsHolding);
SendClientMessage(playerid, SVETLOPLAVA, string);
PlayerInfo += payout;
MatsHolding = 0;
}
else
{
SendClientMessage(playerid, SIVA, "Nemate materijale !");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, "Niste u tvornici materijala!");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, " Invalid Materials Name !");
return 1;
}
}
return 1;
}
Valjda sam te dobro razumeo.
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
14. Feb. 2013.
dali je moguce skratit cmd recimo bez ovog
else
da se ubaci nest drugo a da ima istu funkciju
else
{
SendClientMessage(playerid, SIVA, "Niste u tvornici materijala!");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, " Invalid Materials Name !");
return 1;
}
}
return 1;
}da se ubaci nest drugo a da ima istu funkciju
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
14. Feb. 2013.
ne mislim na to neg da bude manje zagrada
nego tipa ovoga
else return SCM(i tu stavim nisam u tvornici materijala invalid materials name ako me shvacate
SendClientMessage(playerid, SIVA, "Niste u tvornici materijala!");
return 1;
}
}
else
{
SendClientMessage(playerid, SIVA, " Invalid Materials Name !");
return 1;
}
}
return 1;
}nego tipa ovoga
else return SCM(i tu stavim nisam u tvornici materijala invalid materials name ako me shvacate
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
978
Postovi:
98
Teme:
Pridružio se:Maj 2011
14. Feb. 2013.
ivica158 wrote on February 14, 2013, 9:18 pm:
da tak nesta i da bude unutra u cmd sscanf a ne sistem iz strcmp
if(sscanf(params, "u", id)) return SCM(playerid,BELA, "{FFFFFF}DG Pomoc |{00C0FF} /uninvite [ID Igraca]"); ?
Crime Lord
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
926
Postovi:
185
Teme:
Pridružio se:Okt. 2012
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava