GiveCash Problem
#1

#include <a_samp>
#include <dini>
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_BRIGHTRED 0xDC143CAA

#pragma tabsize 0


public OnFilterScriptInit()
{

print("\n--------------------------------------------");
print("Duoti Systema By Remulis");
print("1.0");
print("--------------------------------------------\n");
return 1;
}
//===================================Commands======= ============================
public OnPlayerCommandText(playerid, cmdtext[])
{

new cmd[259],tmp[259];
new idx;
new string[256];
//new playername[MAX_PLAYER_NAME];
new moneys[MAX_PLAYERS];
new giveplayerid;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new playermoney[MAX_PLAYERS];

cmd = strtok(cmdtext, idx);
////////////////////////////////////////////////////////////////////////////////
if(strcmp(cmd, "/duoti", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /Duoti [zaidejoID/zaidejoNickas] [Suma]");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "PVZ: /Duoti 3/Tomas [100000]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /Duoti [zaidejoID/zaidejoNickas] [Suma]");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "PVZ: /Duoti 3/Tomas [100000]");
return 1;
}
moneys[playerid] = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney[playerid] = GetPlayerMoney(playerid);
if (moneys[playerid] > 0 && playermoney[playerid] >= moneys[playerid])
{
GivePlayerMoney(playerid, (0 - moneys[playerid]));
GivePlayerMoney(giveplayerid, moneys[playerid]);
format(string, sizeof(string), "Issiusta %s (id: %d), $%d.", giveplayer,giveplayerid, moneys[playerid]);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Tau Atsiunte $%d %s (id: %d).", moneys[playerid], sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GREEN, string);
printf("%s(playerid:%d) Atsiunte %d %s(playerid:%d)",sendername, playerid, moneys[playerid], giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_BRIGHTRED, "Neimanoma persiusti.");
}
}
else {
format(string, sizeof(string), "ID:%d neaktyvuotas naudotojas.", giveplayerid);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
}
return 1;
}

return 0;
}

C:\Users\Remulis\Desktop\----------SA-MP Server2\filterscripts\Duoti.pwn(34) : error 017: undefined symbol "strtok"
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(34) : error 033: array must be indexed (variable "cmd")
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(3 : error 017: undefined symbol "strtok"
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(3 : error 033: array must be indexed (variable "tmp")
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(46) : error 017: undefined symbol "strtok"
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(46) : error 033: array must be indexed (variable "tmp")
C:\Users\Remulis\Desktop\----------SA-MP Server2 - Copy\SA-MP Server2\filterscripts\Duoti.pwn(25) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

use
pawn Код:
tags
and
Код:
 tags
Reply
#3

?
Reply
#4

Quote:
Originally Posted by RemulisLTU
?
Lol.


He says that you should use pawn tags
pawn Код:
//code
There's a tutorial about that.
Reply
#5

Код:
Quote:
Originally Posted by Pandabeer1337
use
pawn Код:
tags
and
Код:
 tags

he means
Код:
 or the first problem i saw is that strtok is missing.

pawn Код:
strtok(const string[], &index){    new length = strlen(string);    while ((index < length) && (string[index] <= ' '))    {        index++;    }    new offset = index;    new result[20];    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))    {        result[index - offset] = string[index];        index++;    }    result[index - offset] = EOS;    return result;}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)