SA-MP Forums Archive
I need help - 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: I need help (/showthread.php?tid=543075)



I need help - Toxas - 24.10.2014

I am Trying to make a COmmand for admins to get any weapon they want
This is The Text under OnPlayerCommandText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Weapons", cmdtext, true) == 0)
	{
		if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only Admins Can use This Command!");
		else
		{
	    ShowPlayerDialog(playerid, DIALOG_WEAPONS, 2, "Weapons", "Melee Weapons\nPistols\nSub Machine Guns\nShotguns\nRifles\nAssault Rifles\nThrowables\nHeavy Weaponry", "Select", "Cancel");
		}
		return 1;
	}
	return 0;
}
Line 115 is The Line with ShowPlayerDialog
These are the errors I get
Код:
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : error 001: expected token: ",", but found ";"
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : error 029: invalid expression, assumed zero
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : warning 215: expression has no effect
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : warning 215: expression has no effect
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : warning 215: expression has no effect
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : warning 215: expression has no effect
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : warning 215: expression has no effect
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : error 001: expected token: ";", but found ")"
D:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\gamemodes\Zmode.pwn(115) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Plz Help me
I am very new to pawno, so if the mistake is obvious I'm sorry


Re: I need help - GGRoleplay - 24.10.2014

Try this
if(IsPlayerAdmin(playerid))
{

}
else
{
ShowPlayerDialog(playerid, etc);
}


Re: I need help - gurmani11 - 24.10.2014

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Weapons", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only Admins Can use This Command!");
        ShowPlayerDialog(playerid, DIALOG_WEAPONS, 2, "Weapons", "Melee Weapons\nPistols\nSub Machine Guns\nShotguns\nRifles\nAssault Rifles\nThrowables\nHeavy Weaponry", "Select", "Cancel");
        return 1;
    }
    return 0;
}



Re: I need help - Toxas - 24.10.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Weapons", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only Admins Can use This Command!");
        ShowPlayerDialog(playerid, DIALOG_WEAPONS, 2, "Weapons", "Melee Weapons\nPistols\nSub Machine Guns\nShotguns\nRifles\nAssault Rifles\nThrowables\nHeavy Weaponry", "Select", "Cancel");
        return 1;
    }
    return 0;
}
I Still have the Same Errors


Re: I need help - Toxas - 24.10.2014

Quote:
Originally Posted by GGRoleplay
Посмотреть сообщение
Try this
if(IsPlayerAdmin(playerid))
{

}
else
{
ShowPlayerDialog(playerid, etc);
}
Didn't Fix it


Re: I need help - gurmani11 - 24.10.2014

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Weapons", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only Admins Can use This Command!");
        ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Melee Weapons\nPistols\nSub Machine Guns\nShotguns\nRifles\nAssault Rifles\nThrowables\nHeavy Weaponry", "Select", "Cancel");
        return 1;
    }
    return 0;
}
try it


Re: I need help - Toxas - 24.10.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Weapons", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only Admins Can use This Command!");
        ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Melee Weapons\nPistols\nSub Machine Guns\nShotguns\nRifles\nAssault Rifles\nThrowables\nHeavy Weaponry", "Select", "Cancel");
        return 1;
    }
    return 0;
}
try it
I Got the Exact Same Errors when I Tried that


Re: I need help - gurmani11 - 24.10.2014

it compiles for me correctly

be sure that you have this only 1 at the end of OnPlayerCommandText
pawn Код:
return 0;
}



Re: I need help - Toxas - 24.10.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
it compiles for me correctly

be sure that you have this only 1 at the end of OnPlayerCommandText
pawn Код:
return 0;
}
I have it Just Like you have and It Gives me Those Errors


Re: I need help - gurmani11 - 24.10.2014

send me the whole

public OnPlayerCommandText(playerid, cmdtext[])