SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 17/02/2015, 09:18 PM   #1
Alvin007
Huge Clucker
 
Alvin007's Avatar
 
Join Date: Mar 2011
Location: Tunisia
Posts: 245
Reputation: 9
Default Creating a function

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 Code:
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 (c) 1997-2006, ITB CompuPhase


4 Errors.
__________________
Alvin007 is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new function Josh_Main Scripting Help 8 29/09/2014 07:15 PM
Need help with creating function Johnson_boy Help Archive 7 24/04/2011 11:35 AM
Creating a function [ Need help ] Cameltoe Help Archive 3 23/08/2010 07:10 PM


All times are GMT. The time now is 02:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.