SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/06/2018, 11:07 PM   #1
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 120
Reputation: 0
Default Help Meeee.. 4 Errors!

I just included <MV_Youtube> and after that I get 4 error and some warnings .. what is wrong with this code guys?

Code:
d:\SAMPSERVER\samp03\gamemodes\a.pwn(9088) : error 022: must be lvalue (non-constant)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22700) : error 035: argument type mismatch (argument 1)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22701) : error 035: argument type mismatch (argument 4)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24621) : error 022: must be lvalue (non-constant)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(9077) : warning 219: local variable "Distance" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(9077) : warning 203: symbol is never used: "Distance"
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22699) : warning 219: local variable "Title" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22699) : warning 204: symbol is assigned a value that is never used: "Title"
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24613) : warning 219: local variable "Distance" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24613) : warning 203: symbol is never used: "Distance"
PHP Code:
stock GetClosestCar(playeridexception INVALID_VEHICLE_ID)
{
    new
        
FloatDistance//WARNING LINE: 9077
        
target = -1,
        
FloatvPos[3];
    if(!
IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playeridvPos[0], vPos[1], vPos[2]);
    else 
GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);

    for(new 
vMAX_VEHICLESv++) if(GetVehicleModel(v) >= 400)
    {
        if(
!= exception && (target || Distance GetDistanceToCar(playeridvvPos[0], vPos[1], vPos[2])))
        {
            
target v;
            
Distance GetDistanceToCar(playeridvvPos[0], vPos[1], vPos[2]); //ERROR LINE 9088
        
}
    }
    return 
target;
}

stock GetClosestGymTool(playerididx)
{
    new 
Float:Distancetarget = -1//WARNING LINE:24613
    
new Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    for(new 
sMAX_GYMTOOLs++)
    {
        if(
target || Distance GetDistanceToGymTool(playerididxsxyz))
        {
            
target s;
            
Distance GetDistanceToGymTool(playerididxsxyz); //ERROR LINE 24621
        
}
    }
    return 
target;
}
=======================================================================
new 
Title[128]; //WARNING LINE:22699
format(Titlesizeof(Title), "{FFFFFF}Statistic - {33CCFF} %s"GetPlayerNameEx(targetid)); //ERROR LINE:22700
ShowPlayerDialog(playeridDIALOG_STATSDIALOG_STYLE_MSGBOXTitlestr"Ok"""); //ERROR LINE:22701 
AlfaSufaIndo is offline   Reply With Quote
Old 26/06/2018, 11:12 PM   #2
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 120
Reputation: 0
Default Re: Help Meeee.. 4 Errors!

And when I try not to include <MV_Youtube> the errors and the warning is gone
AlfaSufaIndo is offline   Reply With Quote
Old 26/06/2018, 11:36 PM   #3
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 455
Reputation: 35
Default Re: Help Meeee.. 4 Errors!

dont use MV_Youtube it contains those variables and MV_Youtube doesn't even work.
CodeStyle175 is offline   Reply With Quote
Old 27/06/2018, 12:19 AM   #4
Slawi
Little Clucker
 
Join Date: Dec 2013
Posts: 48
Reputation: 1
Default Re: Help Meeee.. 4 Errors!

You need to change the variable name because its already defined
try this
PHP Code:
stock GetClosestCar(playeridexception INVALID_VEHICLE_ID

    new 
        
FloatDistance1//WARNING LINE: 9077 
        
target = -1
        
FloatvPos[3]; 
    if(!
IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playeridvPos[0], vPos[1], vPos[2]); 
    else 
GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]); 

    for(new 
vMAX_VEHICLESv++) if(GetVehicleModel(v) >= 400
    { 
        if(
!= exception && (target || Distance1 GetDistanceToCar(playeridvvPos[0], vPos[1], vPos[2]))) 
        { 
            
target v
            
Distance1 GetDistanceToCar(playeridvvPos[0], vPos[1], vPos[2]); //ERROR LINE 9088 
        

    } 
    return 
target


stock GetClosestGymTool(playerididx

    new 
Float:Distance1target = -1//WARNING LINE:24613 
    
new Float:xFloat:yFloat:z
    
GetPlayerPos(playeridxyz); 
    for(new 
sMAX_GYMTOOLs++) 
    { 
        if(
target || Distance1 GetDistanceToGymTool(playerididxsxyz)) 
        { 
            
target s
            
Distance1 GetDistanceToGymTool(playerididxsxyz); //ERROR LINE 24621 
        

    } 
    return 
target

======================================================================= 
new 
Title1[128]; //WARNING LINE:22699 
format(Title1sizeof(Title1), "{FFFFFF}Statistic - {33CCFF} %s"GetPlayerNameEx(targetid)); //ERROR LINE:22700 
ShowPlayerDialog(playeridDIALOG_STATSDIALOG_STYLE_MSGBOXTitle1str"Ok"""); //ERROR LINE:22701 
Slawi is offline   Reply With Quote
Reply

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
HELP MEEEE n00blek Scripting Help 2 01/09/2017 03:09 PM
Pawn Compiling errors, Errors and Line are inside [ +REP ] EgyptForLife Scripting Help 8 19/07/2014 08:26 PM
Please help meeee !! :'( **ahm_ed** Scripting Help 15 03/08/2012 09:25 PM
Common compiling errors - READ BEFORE POSTING ERRORS Streetplaya Help Archive 0 23/01/2010 11:20 AM


All times are GMT. The time now is 11:16 AM.


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