Errors while compiling
#1

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
Reply
#2

you add something dont need on command
Reply
#3

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;
}
Reply
#4

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..
Reply
#5

add float
Reply
#6

can u show the declaration or whole enum?
Reply
#7

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.
Reply
#8

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)
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)