SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/08/2017, 01:29 AM   #1
Miguelch1312
Big Clucker
 
Miguelch1312's Avatar
 
Join Date: Apr 2013
Location: Location goes here
Posts: 56
Reputation: 5
Question ZCMD Help

Hi,
I converted some commands from STRCMP to ZMCD, but adding the commands to the gm drops warnings, and i wanna know why this is happening.
PD: I'm putting the commands at the end of the gamemode
The warnings:

"GM.pwn(3080) : warning 219: local variable "msg" shadows a variable at a preceding level"
"GM.pwn(4684) : warning 219: local variable "msg" shadows a variable at a preceding level"


Here's the line 4684:
PHP Code:
CMD:claimcoupon(playeridparams[])
{
    new 
title[64], msg[126];//Line 4684
    
format(title,sizeof(title),"{1B8AE4}Claim Coupon");
    
format(msg,sizeof(msg),"Type the coupon code below to\nclaim your reward:");
    
ShowPlayerDialog(playeridcoupon1DIALOG_STYLE_INPUTtitlemsg"Claim""Cancel");
    return 
1;

Here's the line 3080:
PHP Code:
public HouseEnter(playeridhouseid)
{
    if(
PInfo[playerid][House1] == HInfo[houseid][hHouseID]) { new msg[64]; format(msg,sizeof(msg),"Welcome   %s."PlayerName(playerid)); SendClientMessage(playeridCOLOR_WHITEmsg); }//Line 3080
    
if(PInfo[playerid][House2] == HInfo[houseid][hHouseID]) { new msg[64]; format(msg,sizeof(msg),"Welcome home, %s."PlayerName(playerid)); SendClientMessage(playeridCOLOR_WHITEmsg); }
    
InHouse[playerid] = houseid;
    
SetPlayerInterior(playeridHInfo[houseid][hInterior]);
    
SetPlayerPos(playeridHInfo[houseid][hiX],HInfo[houseid][hiY],HInfo[houseid][hiZ]);
    
SetPlayerVirtualWorld(playeridhouseid);
    return 
1;

__________________
Code:
if(strcmp(cmd, "/help", true) == 0)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
Miguelch1312 is offline   Reply With Quote
Old 26/08/2017, 01:45 AM   #2
HoussemGaming
Banned
 
Join Date: Jun 2017
Location: France
Posts: 190
Reputation: 10
Default Re: ZCMD Help

Check if you have a variable called 'msg' in an include
HoussemGaming is offline   Reply With Quote
Old 26/08/2017, 01:51 AM   #3
Miguelch1312
Big Clucker
 
Miguelch1312's Avatar
 
Join Date: Apr 2013
Location: Location goes here
Posts: 56
Reputation: 5
Default Respuesta: Re: ZCMD Help

Quote:
Originally Posted by HoussemGaming View Post
Check if you have a variable called 'msg' in an include
I forgot to say that when i delete the "new msg[]" this appears, GM.pwn(4686) : error 017: undefined symbol "msg".

I'm checking the includes and if you need to know what are the includes:
#include <a_samp>
#include <a_mysql>
#include <streamer>
#include <sscanf2>
#include <utils>
#include <zcmd>

PD: I've checked the includes but anyone has msg defined, and i've more "new msg[]" but if i delete the ZCMD commands the warnings doesn't appear anymore
__________________
Code:
if(strcmp(cmd, "/help", true) == 0)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
Miguelch1312 is offline   Reply With Quote
Old 26/08/2017, 03:03 AM   #4
Miguelch1312
Big Clucker
 
Miguelch1312's Avatar
 
Join Date: Apr 2013
Location: Location goes here
Posts: 56
Reputation: 5
Default Respuesta: ZCMD Help

Help plox
__________________
Code:
if(strcmp(cmd, "/help", true) == 0)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
Miguelch1312 is offline   Reply With Quote
Old 26/08/2017, 04:21 AM   #5
Miguelch1312
Big Clucker
 
Miguelch1312's Avatar
 
Join Date: Apr 2013
Location: Location goes here
Posts: 56
Reputation: 5
Default Respuesta: Re: ZCMD Help

Quote:
Originally Posted by GuilhermeNunes View Post
Friend do not use Converters they always give the wrong code learn to use ZCMD and manually pass to your server use G O O G L E to find tutorials

Code:
CMD:help(playerid)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
I converted the commands by myself :v, i like to script, i don't use things like that xD, the thing you converted is my sign, not the command, the full info is on the top of the post
__________________
Code:
if(strcmp(cmd, "/help", true) == 0)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
Miguelch1312 is offline   Reply With Quote
Old 26/08/2017, 10:07 AM   #6
FuNkYTheGreat
Huge Clucker
 
FuNkYTheGreat's Avatar
 
Join Date: Jun 2016
Location: Pakistan.
Posts: 270
Reputation: 124
Default Re: ZCMD Help

Code:
CMD:claimcoupon(playerid, params[])
{
    new title[64], msg2[126];//Line 4684
    format(title,sizeof(title),"{1B8AE4}Claim Coupon");
    format(msg2,sizeof(msg2),"Type the coupon code below to\nclaim your reward:");
    ShowPlayerDialog(playerid, coupon1, DIALOG_STYLE_INPUT, title, msg2, "Claim", "Cancel");
    return 1;
}
public HouseEnter(playerid, houseid)
{
    if(PInfo[playerid][House1] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome   %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }//Line 3080
    if(PInfo[playerid][House2] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome home, %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }
    InHouse[playerid] = houseid;
    SetPlayerInterior(playerid, HInfo[houseid][hInterior]);
    SetPlayerPos(playerid, HInfo[houseid][hiX],HInfo[houseid][hiY],HInfo[houseid][hiZ]);
    SetPlayerVirtualWorld(playerid, houseid);
    return 1;
}
In your script somewhere msg variable was already in use and it was a global variable , So it was conflicting with your those msg variable,
I change your msg variable to msg2, Now it'll works fine.
FuNkYTheGreat is offline   Reply With Quote
Old 26/08/2017, 12:10 PM   #7
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default Re: ZCMD Help

Quote:
Originally Posted by FuNkYTheGreat View Post
Code:
CMD:claimcoupon(playerid, params[])
{
    new title[64], msg2[126];//Line 4684
    format(title,sizeof(title),"{1B8AE4}Claim Coupon");
    format(msg2,sizeof(msg2),"Type the coupon code below to\nclaim your reward:");
    ShowPlayerDialog(playerid, coupon1, DIALOG_STYLE_INPUT, title, msg2, "Claim", "Cancel");
    return 1;
}
public HouseEnter(playerid, houseid)
{
    if(PInfo[playerid][House1] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome   %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }//Line 3080
    if(PInfo[playerid][House2] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome home, %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }
    InHouse[playerid] = houseid;
    SetPlayerInterior(playerid, HInfo[houseid][hInterior]);
    SetPlayerPos(playerid, HInfo[houseid][hiX],HInfo[houseid][hiY],HInfo[houseid][hiZ]);
    SetPlayerVirtualWorld(playerid, houseid);
    return 1;
}
In your script somewhere msg variable was already in use and it was a global variable , So it was conflicting with your those msg variable,
I change your msg variable to msg2, Now it'll works fine.
You don't solve a problem by skirting it. You gave him the solution.
There is a global value or a public variable which is already called msg
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 26/08/2017, 12:24 PM   #8
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,090
Reputation: 2655
Default Re: ZCMD Help

It may also be an enum specifier or a definition so look for that too.
__________________
Vince is offline   Reply With Quote
Old 26/08/2017, 01:26 PM   #9
FuNkYTheGreat
Huge Clucker
 
FuNkYTheGreat's Avatar
 
Join Date: Jun 2016
Location: Pakistan.
Posts: 270
Reputation: 124
Default Re: ZCMD Help

[quote = Dayrion]You don't solve a problem by skirting it. You gave him the solution.
There is a global value or a public variable which is already called msg[/quote]
Maybe the msg variable that's giving a warning will be in use? Don't you think that, And i already said the reason,
Don't try to act over smart dude !
FuNkYTheGreat is offline   Reply With Quote
Old 26/08/2017, 01:51 PM   #10
Miguelch1312
Big Clucker
 
Miguelch1312's Avatar
 
Join Date: Apr 2013
Location: Location goes here
Posts: 56
Reputation: 5
Default Respuesta: Re: ZCMD Help

Quote:
Originally Posted by FuNkYTheGreat View Post
Code:
CMD:claimcoupon(playerid, params[])
{
    new title[64], msg2[126];//Line 4684
    format(title,sizeof(title),"{1B8AE4}Claim Coupon");
    format(msg2,sizeof(msg2),"Type the coupon code below to\nclaim your reward:");
    ShowPlayerDialog(playerid, coupon1, DIALOG_STYLE_INPUT, title, msg2, "Claim", "Cancel");
    return 1;
}
public HouseEnter(playerid, houseid)
{
    if(PInfo[playerid][House1] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome   %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }//Line 3080
    if(PInfo[playerid][House2] == HInfo[houseid][hHouseID]) { new msg2[64]; format(msg2,sizeof(msg2),"Welcome home, %s.", PlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, msg2); }
    InHouse[playerid] = houseid;
    SetPlayerInterior(playerid, HInfo[houseid][hInterior]);
    SetPlayerPos(playerid, HInfo[houseid][hiX],HInfo[houseid][hiY],HInfo[houseid][hiZ]);
    SetPlayerVirtualWorld(playerid, houseid);
    return 1;
}
In your script somewhere msg variable was already in use and it was a global variable , So it was conflicting with your those msg variable,
I change your msg variable to msg2, Now it'll works fine.
Thanks everyone, but i have more "New MSG" in my gm, and they never conflicted, the problem appears when i add the ZCMD commands, but if i remove it, the problem disappear. I know why the warnings appear, but i don't know why those ones appears when i add the zcmd, look, there isn't the only warning

GM.pwn(3819) : warning 219: local variable "msg" shadows a variable at a preceding level
GM.pwn(3881) : warning 219: local variable "msg" shadows a variable at a preceding level
GM.pwn(391 : warning 219: local variable "msg" shadows a variable at a preceding level
GM.pwn(3955) : warning 219: local variable "msg" shadows a variable at a preceding level

But if i remove the ZCMDS the warnings disappear.
__________________
Code:
if(strcmp(cmd, "/help", true) == 0)
{
     SendClientMessage(playerid, -1, "[ERROR]Insufficient knowledgement");
     return 1;
}
Miguelch1312 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
Having Error with ZCMD Immortal99 Scripting Help 2 14/08/2016 07:48 AM
Zcmd error... dundolina Scripting Help 1 25/11/2014 12:48 PM
ZCMD error verlaj Scripting Help 7 23/10/2012 04:29 PM
ZCMD error marrcko Help Archive 3 11/06/2011 03:52 PM
zcmd error eXtr1kE Help Archive 2 01/10/2010 04:43 PM


All times are GMT. The time now is 03:47 PM.


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