Creating a function
#1

Actually i have a problem with creating functions, it's a small one don't worry.
In my case i want to make a function to update a business 3D text label.
I searched everywhere in samp wiki, i found pre-made functions such as CreateVehicle etc..
And i found functions that can use only the variable (playerid)
In my case i need 2 parameters which are bizname and bizid.

Here is the Script:
PHP код:
new bizidbizname[100];
ChangeBizInfo(bizid,bizname[])
{
    new 
string[300];
    
BusinessInfo[bizid][bName] = bizname;
    
format(string,sizeof(string),"{FF0000}SERVER:{FFFFFF} You successfully changed your business bizname id [%i], to %s",bizid,bizname);
    
SendClientMessage(playeridYELLOWstring);
    
SaveBusiness(bizid);
    new 
salemsg[100],total[400],thestring[260],lockmsg[40];
    if(
BusinessInfo[bizid][bPrice]>-1format(salemsg,sizeof(salemsg),"[{009ACD}FOR SALE{FFFFFF}]\t {009ACD}Price:{FFFFFF} %i\n",BusinessInfo[bizid][bPrice]);
    else 
format(salemsg,sizeof(salemsg)," ");
    if(
BusinessInfo[bizid][bOwned]==1format(thestring,sizeof(thestring),"{009ACD}Name:{FFFFFF} %s \n {009ACD}Owner:{FFFFFF} %s \n ID: %d",bizname,BusinessInfo[bizid][bOwner],bizid);
    else 
format(thestring,sizeof(thestring),"{009ACD}Name:{FFFFFF} %s \n {009ACD}Owner:{FFFFFF} None \n ID: %d",bizname,bizid);
    if(
BusinessInfo[bizid][bLocked]==1format(lockmsg,sizeof(lockmsg),"[{009ACD}CLOSED{FFFFFF}]\n");
    else 
format(lockmsg,sizeof(lockmsg),"[{009ACD}OPEN{FFFFFF}]\n");
    
format(total,sizeof(total),"%s %s %s",salemsg,lockmsg,thestring);
    
Delete3DTextLabel(BizLabel[bizid]);
    
Create3DTextLabel(total,COLOR_WHITE,BusinessInfo[bizid][bEntranceX], BusinessInfo[bizid][bEntranceY], BusinessInfo[bizid][bEntranceZ],5.0BusinessInfo[bizid][bWorld]);
    return 
1;

And here is the error:
Quote:

C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 346) : warning 219: local variable "bizid" shadows a variable at a preceding level
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 346) : warning 219: local variable "bizname" shadows a variable at a preceding level
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 349) : error 047: array sizes do not match, or destination array is too small
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 351) : error 017: undefined symbol "playerid"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 361) : error 017: undefined symbol "BizLabel"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 70 : error 001: expected token: ";", but found "}"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 1681) : warning 203: symbol is never used: "bizid"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 1681) : warning 203: symbol is never used: "bizname"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Messages In This Thread
Creating a function - by Alvin007 - 17.02.2015, 20:18
Re: Creating a function - by HazardouS - 17.02.2015, 20:40
Re: Creating a function - by CalvinC - 17.02.2015, 20:42
Re : Creating a function - by Alvin007 - 17.02.2015, 21:11
Re: Creating a function - by CalvinC - 17.02.2015, 21:24
Re : Creating a function - by Alvin007 - 17.02.2015, 21:34
Re : Creating a function - by Alvin007 - 18.02.2015, 10:48
Re: Re : Creating a function - by Gammix - 18.02.2015, 13:22
Re : Creating a function - by Alvin007 - 19.02.2015, 11:08
Re: Re : Creating a function - by Excel™ - 19.02.2015, 11:34

Forum Jump:


Users browsing this thread: 1 Guest(s)