[Pomoc]Komanda

Započeo SlicK, Decembar 12, 2010, 22:39:32 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Pozdrav,evo nedavno sam poceo koristiti ZCMD i sad imam problem,neke komande neznam prebacit u ZCMD npr.ovu:
if(strcmp(cmd, "/pay", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Koristiti: /pay [ID/DioImena] [kolicina]");
return 1;
}
//giveplayerid = strval(tmp);
       giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Koristiti: /pay [ID/DioImena] [amount]");
return 1;
}
moneys = strval(tmp);
if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, "Morate biti level 3 da bi platili vise od 1000");
return 1;
}
if(moneys < 1 || moneys > 99999)
{
   SendClientMessage(playerid, COLOR_GRAD1, "Nemozete ici ispod $1 i iznad $99999 odjednom.");
   return 1;
}
if (IsPlayerConnected(giveplayerid))
{
   if(giveplayerid != INVALID_PLAYER_ID)
   {
       if(PlayerInfo[giveplayerid][pLocal] == 106)
{
SendClientMessage(playerid, COLOR_GRAD1, "Komanda nije dopustena u ovoj lokaciji");
return 1;
}
if (ProxDetectorS(5.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerCash(playerid);
if (moneys > 0 && playermoney >= moneys)
{
   ConsumingMoney[giveplayerid] = 1;
GivePlayerCash(playerid, (0 - moneys));
GivePlayerCash(giveplayerid, moneys);
format(string, sizeof(string), "   Poslali ste %s(Igracu: %d), $%d.", giveplayer,giveplayerid, moneys);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), "   Primili ste $%d od %s(Igrac: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "%s je dao $%d igracu %s", sendername, moneys, giveplayer);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s vadi nesto novaca, i daje ga %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Krivi iznos.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Predaleko ste.");
}
}//invalid id
}
else
{
format(string, sizeof(string), "   %d nije aktivan igrac.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}

Molio bih vas da mi pomognete!

EDIT: Ove stvari me muce:

        giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
Poslednja Izmena: Decembar 12, 2010, 22:44:18 POSLE PODNE od Slick Crack
Mysterious roleplay


COMMAND:pay(playerid,params[])
{
 new
 id,
 kolicina,
 giveplayer[MAX_PLAYER_NAME],
 sendername[MAX_PLAYER_NAME]
 ;
 if(sscanf(params,"ud",id,kolicina)) return SendClientMessage(playerid, COLOR_GRAD1, "Koristiti: /pay [ID/DioImena] [kolicina]");
 else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Taj igrac nije online.");
 else if(kolicina > 1000 && PlayerInfo[playerid][pLevel] < 3) {
     SendClientMessage(playerid, COLOR_GRAD1, "Morate biti level 3 da bi platili vise od 1000");
   return true; }
   else if(kolicina < 1 || kolicina > 99999) {
     SendClientMessage(playerid, COLOR_GRAD1, "Nemozete ici ispod $1 i iznad $99999 odjednom.");
     return true; }
     else if(PlayerInfo[id][pLocal] == 106) {
     SendClientMessage(playerid, COLOR_GRAD1, "Komanda nije dopustena u ovoj lokaciji");
     return true; }
     else if (ProxDetectorS(5.0, playerid, giveplayerid))
     {
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerCash(playerid);
if (kolicina > 0 && playermoney >= kolicina)
{
              ConsumingMoney[id] = 1;
  GivePlayerCash(playerid, (0 - moneys));
  GivePlayerCash(id, moneys);
  format(string, sizeof(string), "   Poslali ste %s(Igracu: %d), $%d.", giveplayer,id, moneys);
  PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  SendClientMessage(playerid, COLOR_GRAD1, string);
  format(string, sizeof(string), "   Primili ste $%d od %s(Igrac: %d).", moneys, sendername, playerid);
  SendClientMessage(giveplayerid, COLOR_GRAD1, string);
  format(string, sizeof(string), "%s je dao $%d igracu %s", sendername, moneys, giveplayer);
  PlayerPlaySound(id, 1052, 0.0, 0.0, 0.0);
              format(string, sizeof(string), "* %s vadi nesto novaca, i daje ga %s.", sendername ,giveplayer);
  ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
              SendClientMessage(playerid, COLOR_GRAD1, "Krivi iznos.");
}
 }
 return true;
}



Nisam testirao, vjerojatno ima koji error ili gresku ali to vjerojatno znas sam ispraviti ;)
Poslednja Izmena: Decembar 12, 2010, 22:49:56 POSLE PODNE od [H]265
Kristijan Stipić

A hvala,valjda cu skuzit,nisam mislio da mi komandu napravis nego da mi malo objasnite! :/
Mysterious roleplay

A samo da znas, imas NEKOLIKO tutoriala ZCMD-a, DCMD-a, strcmp-a, sscanf-a samo ti bi sve nabrzaka, eto ti jos http://wiki.sa-mp.com/wiki/Fast_Commands malo potrazi sam  ::)
Kristijan Stipić

Citat: [H]265 poslato Decembar 12, 2010, 23:00:41 POSLE PODNE
A samo da znas, imas NEKOLIKO tutoriala ZCMD-a, DCMD-a, strcmp-a, sscanf-a samo ti bi sve nabrzaka, eto ti jos http://wiki.sa-mp.com/wiki/Fast_Commands malo potrazi sam  ::)

E tako vec da...Hvala ti puno! Respect! ;)
Mysterious roleplay