#1

Basically i want to make a random of robbed money from a biz. But it will give errors
PHP код:
new Robbed randomBusiness[c][bMoney];)+1
We can't use any enum variables in it?
Reply
#2

Код:
new Robbed = random( Business[c][bMoney])+1;
You had extra ';' after this 'Business[c][bMoney]'
Reply
#3

Still the same errors
PHP код:
(1089) : error 017undefined symbol "Business"
(1089) : warning 215expression has no effect
(1089) : error 001expected token";"but found "]"
(1089) : error 029invalid expressionassumed zero
(1089) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


4 Errors

Reply
#4

Show full code
Reply
#5

PHP код:
new BusinessInfo[200][bInfo]; 
PHP код:
enum bInfo {
    
bOwned,
    
bPrice,
    
bOwner[MAX_PLAYER_NAME],
    
bType,
    
bLocked,
    
brobbed,
    
bdep,
    
bMoney,
    
Fee,
    
Float:bEntranceX,
    
Float:bEntranceY,
    
Float:bEntranceZ,
    
Float:bEntranceA,
    
Float:bExitX,
    
Float:bExitY,
    
Float:bExitZ,
    
Float:bExitA,
    
bInt,
    
bWorld,
    
bInsideInt,
    
bInsideWorld,
    
bInsideIcon,
    
bOutsideIcon,
    
bName[128]

Every variable works but in random it doesn't
Reply
#6

Where is business located? Enums should be at top.

It you use random thing before defining the enumator it won't be able to read it.
Reply
#7

Yes enum is at the top and new is at the bottom
Reply
#8

Try assigning the value to a integer and put that into random().

New myVal = b...
New Random = Random(myVal);
Reply
#9

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Try assigning the value to a integer and put that into random().

New myVal = b...
New Random = Random(myVal);
That worked though. Here is the full code
PHP код:
forward Robbiz(playerid);
public 
Robbiz(playerid)
{
    new 
InsideBiz[playerid];
    new 
Robbed random(Business[c][bMoney])+1;
    new 
string[120];
    
format(string,sizeof(string),"[ROBBERY]: %s has robbed $%d from %s's biz",PN(playerid),Robbed,Business[c][bOwner]);
    
SCMToAll(COLOR_GREEN,string);
    
GivePlayerMoney(playerid,Robbed);
    
Business[c][bMoney] = Business[c][bMoney]-Robbed;
    
pInfo[playerid][rScore] = pInfo[playerid][rScore]+5;
    
SetPlayerScore(playeridpInfo[playerid][cScore] + pInfo[playerid][rScore]);
    
SCM(playerid, -1"[INFO]: Biz robbed successfully. 5 criminal scores awarded!");
    return 
1;

InsideBiz is holding the biz's id
Reply
#10

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
That worked though. Here is the full code
if it worked then whats the problem now.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)