SA-MP Forums Archive
Errors while compiling - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors while compiling (/showthread.php?tid=614171)



Errors while compiling - DarkElement - 05.08.2016

So I've put that code, and when I wanted to compile it gave me 1 warning.

Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel]) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}
That's the warning: http://imgur.com/a/AQFyX


Re: Errors while compiling - Dejan12345 - 05.08.2016

you add something dont need on command


Re: Errors while compiling - CodyHawkins - 05.08.2016

You need to use control structures properly, please read this:
https://sampwiki.blast.hk/wiki/Control_Structures#if

If you want it for all admin levels, try:
Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel] => 1) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}



Re: Errors while compiling - DarkElement - 05.08.2016

Quote:
Originally Posted by CodyHawkins
Посмотреть сообщение
You need to use control structures properly, please read this:
https://sampwiki.blast.hk/wiki/Control_Structures#if

If you want it for all admin levels, try:
Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel] => 1) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}
It still gave me the same error..


Re: Errors while compiling - Dejan12345 - 05.08.2016

add float


Re: Errors while compiling - SyS - 05.08.2016

can u show the declaration or whole enum?


Re: Errors while compiling - Quinncell - 05.08.2016

Quote:
Originally Posted by Dejan12345
Посмотреть сообщение
add float
please stop helping..

and it's not an error, it's just a warning, look it up on the SA-MP wiki to understand it more.


Re: Errors while compiling - F1N4L - 05.08.2016

Quote:
Originally Posted by CodyHawkins
Посмотреть сообщение
You need to use control structures properly, please read this:
https://sampwiki.blast.hk/wiki/Control_Structures#if

If you want it for all admin levels, try:
Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel] => 1) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}
Код:
if(PlayerInfo[playerid][pAdminLevel])
//or
if(PlayerInfo[playerid][pAdminLevel] > 0)
Код:
if(!PlayerInfo[playerid][pAdminLevel])
//or
if(PlayerInfo[playerid][pAdminLevel] < 1)



Re: Errors while compiling - CodyHawkins - 05.08.2016

Quote:
Originally Posted by DarkElement
Посмотреть сообщение
It still gave me the same error..
My bad, try:
Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel] >= 1) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}
I changed => to >=, you could either do that or do > 0 like the post above.


Re: Errors while compiling - Luicy. - 05.08.2016

Quote:
Originally Posted by CodyHawkins
Посмотреть сообщение
My bad, try:
Код:
CMD:go(playerid)
{
    if(PlayerInfo[playerid][pAdminLevel] >= 1) ShowPlayerDialog(playerid, DIALOG_GO, DIALOG_STYLE_LIST, "SERVER: Teleport Locations", "House Interiors\nRace Tracks\nCity Locations\nPopular Locations\nGym Interiors\nOther", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_WHITE, "Only admins are allowed to use this command!");
    return 1;
}
I changed => to >=, you could either do that or do > 0 like the post above.
Just.. The if() has nothing to do with the problem.

--
Which line has the error?