these define make Pawn Compiler stop roking
#1

Hello guys i have these defines when i enter them it make my pawn compiler strop working

pawn Код:
#define ForEach(%0,%1) \
    for(new %0 = 0; %0 != %1; %0++) if(IsPlayerConnected(%0) && !IsPlayerNPC(%0))

#define Loop(%0,%1) \
    for(new %0 = 0; %0 != %1; %0++)
   
#define IsOdd(%1) \
    ((%1) & 1)
   
#define ConvertTime(%0,%1,%2,%3,%4) \
    new \
        Float: %0 = floatdiv(%1, 60000) \
    ;\
    %2 = floatround(%0, floatround_tozero); \
    %3 = floatround(floatmul(%0 - %2, 60), floatround_tozero); \
    %4 = floatround(floatmul(floatmul(%0 - %2, 60) - %3, 1000), floatround_tozero)
   
#define function%0(%1) \
    forward%0(%1); public%0(%1)
Reply
#2

Why do people insist on cramming everything into a definition? Use a function for ConvertTime. Rest looks fine.
Reply
#3

What type of Convertime function?
Reply
#4

nvm it worked
Reply
#5

Didn't know you scripted too.
Reply
#6

xD i quit scripting but i came back

Anyways i get this error

Код:
C:\Users\Sony\Desktop\USA Gang Wars TDM\gamemodes\Usagangwarsv1.3.pwn(2912) : error 017: undefined symbol "isnull"
C:\Users\Sony\Desktop\USA Gang Wars TDM\gamemodes\Usagangwarsv1.3.pwn(2913) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
the lines are

pawn Код:
if(isnull(params))return SendClientMessage(playerid, COLOR_SININE, "USAGE: /startrace [racename]");
LoadRace(playerid, params);
Need help
Reply
#7

Post whole cmd.
Reply
#8

pawn Код:
dcmd_startrace(playerid, cmdtext[])
{
#pragma unused cmdtext
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Unknown command.");
if(AutomaticRace == true) return SendClientMessage(playerid, COLOR_PINK2, "Not possible.Automatic race is enabled!");
if(BuildRace != 0) return SendClientMessage(playerid, COLOR_PINK2, "There's someone building a race!");
if(RaceBusy == 0x01 || RaceStarted == 1) return SendClientMessage(playerid, COLOR_PINK2, "A race currently going on. Wait till the race ends");
if(isnull(params))return SendClientMessage(playerid, COLOR_SININE, "USAGE: /startrace [racename]");
LoadRace(playerid, params);
return 1;
}
Reply
#9

Replace cmdtext with params at the top of your command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)