Help in converting(+rep)
#1

Hi all
I am Changing my old commands to zcmd
so i have ended up with having errors:
PHP код:
C:\Users\Farha\Desktop\New Server\CNRSF\pawno\include\cnr/lotto.inc(81) : error 017undefined symbol "strtok"
C:\Users\Farha\Desktop\New Server\CNRSF\pawno\include\cnr/lotto.inc(81) : error 033: array must be indexed (variable "cmds")
C:\Users\Farha\Desktop\New Server\CNRSF\pawno\include\cnr/lotto.inc(83) : error 017undefined symbol "strtok"
C:\Users\Farha\Desktop\New Server\CNRSF\pawno\include\cnr/lotto.inc(83) : error 033: array must be indexed (variable "dir")
C:\Users\Farha\Desktop\New Server\CNRSF\pawno\include\cnr/lotto.inc(80) : warning 203symbol is never used"idxs" 
My code is this
PHP код:
CMD:lotto(playeridparams[])
{
new 
cmds[256];
new 
idxs;
cmds strtok(cmdtextidxs);
new 
dir[256];
dir strtok(cmdtextidxs);
if (!
strlen(dir))
{
    
SendClientMessage(playeridCOLOR_RED"SYNTAX: /lotto [number]");
    return 
1;
}
new 
number strval(dir);
if (
LottoParticipant[playerid] == 1)
{
    
SendClientMessage(playeridCOLOR_RED"You already have a lotto ticket.");
}
else
{
if (
GetPlayerMoney(playerid) >= LOTTO_PRICE)
{
if (
number && number 100)
{
if (
NumberUsed[number] == 0)
{
new 
strings[256];
format(stringssizeof(strings), "You have purchased the lotto number %d and you have been charged $5000 for the ticket."number);
SendClientMessage(playerid,COLOR_YELLOW,strings);
SendClientMessage(playerid,COLOR_YELLOW,"Draw will commence at 06:00 and 18:00.");
PlayerLottoGuess[playerid] = number;
LottoParticipant[playerid] = 1;
takeMoney(playerid,5000);
}
else
{
SendClientMessage(playeridCOLOR_RED"The number you selected is already choosed by another player.");
}
}
else
{
SendClientMessage(playeridCOLOR_RED"The number you entered is invalid, please type a number between 0 and 98.");
}
}
else
{
SendClientMessage(playeridCOLOR_RED"You do not have enought money to buy a lotto ticket.");
}
}
return 
1;

Reply
#2

Use sscanf, It'll be easier
Код:
CMD:lotto(playerid, params[])
{
new number;
if (sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /lotto [number]");
if (LottoParticipant[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a lotto ticket");
if (GetPlayerMoney(playerid) < LOTTO_PRICE)  return SendClientMessage(playerid, COLOR_RED, "You don't have enough money");
if (number < 0 || number > 100) return SendClientMessage(playerid, COLOR_RED, "ERROR: Choose a number between 0 and 100");
if (NumberUsed[number] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: This number is already taken");

new strings[256];
format(strings, sizeof(strings), "You have purchased the lotto number %d and you have been charged $5000 for the ticket.", number);
SendClientMessage(playerid,COLOR_YELLOW,strings);
SendClientMessage(playerid,COLOR_YELLOW,"Draw will commence at 06:00 and 18:00.");
PlayerLottoGuess[playerid] = number;
LottoParticipant[playerid] = 1;
takeMoney(playerid,5000);

return 1;
}
Reply
#3

Quote:
Originally Posted by Ebisu
Посмотреть сообщение
Use sscanf, It'll be easier
Exactly, I also uses sscanf
Reply
#4

thnx
++ reped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)