[POMOC] YCMD

Započeo V_More
8. Apr. 2012. Zaključano
1,249
pregleda
9
postova
Hustley
4
Made Man
8. Apr. 2012.
Skripta koju koristim: Moj GM od 0
Detaljan opis problema: Ovako, poceo sam da radim komande i sve to za moj mod koji radim, sada me zanima, ako igrac nesto krivo napise(paremetri kod komande, ili uopste komandu pogrijesi, koja ne postoji) da mu ispise kako se pravilno koristi, a da ako ne postoji komanda, da mu ispise neki tekst, kao recimo SERVER || Da vidite listu komandi, kucajte /komande ? Ili cu to morati sam stavljati kod svake komande ? Znaci, ako mi mozete reci ovdje kako se to radi i kod stavit, ja cu onda kasnije sam probat nesto sklopit, inace YCMD!
Dio skripte: //
Neke slike/video za lakse dobivanje pomoci(neobavezno): //
Luis
5
Godfather
8. Apr. 2012.
cek zelis promijeniti Unkown commands onda :
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
return SendClientMessage(playerid, -1, "Ta komanda ne postoji!");
return 1;
}

a ako zelis u komandi da ti izbaci onda koristis sscanf ..
http://forum.sa-mp.com/showthread.php?t=120356
Hustley
4
Made Man
8. Apr. 2012.
Quote from April 8, 2012, 5:22 pm:
cek zelis promijeniti Unkown commands onda :
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
return SendClientMessage(playerid, -1, "Ta komanda ne postoji!");
return 1;
}

a ako zelis u komandi da ti izbaci onda koristis sscanf ..
http://forum.sa-mp.com/showthread.php?t=120356


U redu, ovo je za YCMD?

Inace, ima li neki tut za sscanf, te zasta se on tacno koristi ?
Luis
5
Godfather
8. Apr. 2012.
Upravo sam ti dao tut http://forum.sa-mp.com/showthread.php?t=120356 ...
sscanf ti je  kao string splitter odnosno tekst mozes podijeliti u dijelove ...

Primjer :
if (sscanf(params, "ud", giveplayerid, amount))return SendClientMessage(playerid, -1, "Usage: /givecash  ");

sada imas sve u toj temi spicifikacije i ostalo :
Specifier(s)			Name				Example values
i, d Integer 1, 42, -10
c Character a, o, *
l Logical true, false
b Binary 01001, 0b1100
h, x Hex 1A, 0x23
o Octal 045 12
n Number 42, 0b010, 0xAC, 045
f Float 0.7, -99.5
g IEEE Float 0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
u User name/id (bots and players) Y_Less, 0
q Bot name/id ShopBot, 27
r Player name/id Y_Less, 42
Hustley
4
Made Man
8. Apr. 2012.
U redu, imam nekoliko pitanja:

1. Ima li to veze sa onom format, za formatiranje poruke?
2. Sta znaci ovo if(sscanf... sta to pokazuje? da ako ima sscanf include da radi ono sto ce biti za napisano, ili sta?
3. Onda kod varijabli, ako stavimo i za integrer, i na i se unese taj broj, onda mozemo i da staviomo to na npr. PlayerInfo = i; ?

Ako mozes napraviti po tom komandu /setskin na YCMD, da vidim primjer  puno ti hvala.
Maki187
5
Crime Lord
8. Apr. 2012.
Izvoli primer komande za freeze i mog moda (gm od 0)
CMD:freeze(playerid, params[])
{
new string; new ime;
new igrac;
if(sscanf(params, "u", igrac))
{
SendClientMessage(playerid, BELA, "POMOC: /freeze [id/ime]");
return 1;
}
if(PlayerInfo == 1 && PlayerInfo >= 1 || PlayerInfo == 1 && PlayerInfo >= 1)
{
new admin = PlayerInfo;
if(admin >= 6) return SendClientMessage(playerid, SIVA, "Nemozes ownera da zaledis!");
if(Freezan == 1) return SendClientMessage(playerid, SIVA, "Igrac je vec zaledjen!");
GetPlayerName(igrac, ime, sizeof(ime));
TogglePlayerControllable(igrac, 0);
Freezan = 1;
GameTextForPlayer(igrac, "~r~Admin te je zaledio!",5000,3);
format(string, sizeof(string), "Zaledio si %s (%d)", ime, igrac);
SendClientMessage(playerid, NARANDZASTA, string);
new aime; GetPlayerName(playerid, aime, sizeof(aime));
format(string, sizeof(string), "Admin %s je zaledio %s", aime, ime);
AdminGMPoruka(ZUTA, string, 1);
}
else
{
SendClientMessage(playerid, SIVA, "Nisi na duznosti, ili nisi ovlascen da koristis ovu komandu!");
}
return 1;
}


samo aj koristim zcmd, skoro isto ko i YCMD

tu tacno mozes videti zasta sluzi sscanf, tj kako se koristi
Luis
5
Godfather
8. Apr. 2012.
Evo na brzinu nisam testao ali preko toga ti mogu pojasniti :
YCMD:setskin(playerid,params[],help)
{
    new skin,ID,string;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Nisi admin");
if(sscanf(params, "ud", ID, skin)) return SendClientMessage(playerid, -1, "KORISTI: /setskin playerid skin");
else if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"igrac je offline!");
else {
SetPlayerSkin(playerid, skin);
return 1;
}

u - User name/id (bots and players) - za igraca / id koji je online
d - Integer / neki broj ...

takoder malo jos pogledas kako se koristi jos jedna tema http://forum.sa-mp.com/showthread.php?t=169029
Hustley
4
Made Man
9. Apr. 2012.
U redu, a samo da pitamovo IsPlayerAdmin, moze se zamjenite sa onim if(!PlayerInfo > 0) return SendClientMessage(...)? Posto bi onda ovo IsPlayerAdmin bil osamo za RCON 😄
Hustley
4
Made Man
9. Apr. 2012.
Quote from April 8, 2012, 5:22 pm:
cek zelis promijeniti Unkown commands onda :
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
return SendClientMessage(playerid, -1, "Ta komanda ne postoji!");
return 1;
}

a ako zelis u komandi da ti izbaci onda koristis sscanf ..
http://forum.sa-mp.com/showthread.php?t=120356


izvinjavam se za dp, ali ovo mi nece, opet mi pise SERVER: Unknown command

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha