SA-MP Forums Archive
Script 2 warnings can't solve it please help me. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Script 2 warnings can't solve it please help me. (/showthread.php?tid=180446)



Script 2 warnings can't solve it please help me. - Scriptissue - 01.10.2010

I tired to make a Giveweapon command but it didn't work.
I have to warnings:
PHP код:
C:\Documents and Settings\My Documents\Downloads\samp03bsvr_R2_win32\filterscripts\slap.pwn(187) : error 004: function "giveweaponstohim" is not implemented
C
:\Documents and Settings\My Documents\Downloads\samp03bsvr_R2_win32\filterscripts\slap.pwn(207) : error 030compound statement not closed at the end of file (started at line 162)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

PHP код:
forward giveweaponstohim(otherIdgunIDgunAmmo);
CMD:gw(playeridparams[])
{
if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF4646FF"You are not authorized to use that command !");
else
{
  new 
otherId;
  new 
sendername[MAX_PLAYER_NAME];
  new 
giveplayer[MAX_PLAYER_NAME];
  new 
string[256];
  if(
sscanf(params"u"otherId)) return SendClientMessage(playerid0xAFAFAFAA"USAGE: gw [PlayerID/PartOfName] [Weapon ID] [Ammo]");
  
format(stringsizeof(string), "* You Jailed %s."giveplayer);
  
SendClientMessage(playeridCOLOR_LIGHTREDstring);
 if(
otherId == INVALID_PLAYER_ID) return SendClientMessage(otherId0xAFAFAFAA"Invalid Player ID");
   {
{
new 
gunID GetPlayerWeapon(playerid);
new 
gunAmmo GetPlayerAmmo(playerid);
GetPlayerName(playeridsendernamesizeof(sendername));
if(
gunID != && gunAmmo != 0)
{
giveweaponstohim(otherIdgunIDgunAmmo);
return 
1;
}
GetPlayerName(playeridsendernamesizeof(sendername));
format(stringsizeof(string), "* You have been given a weapon by Admin %s "sendername );
                
SendClientMessage(playerid0xFF4646FFstring);
}
        }
    return 
1;




Re: Script 2 warnings can't solve it please help me. - [XST]O_x - 01.10.2010

The first one means that the function 'giveweaponstohim' is unimplemented, means you've only declared it. (forward giveweaponstohim).

You need to implement the function:
pawn Код:
public giveweaponstohim(...)
{
   
}
The second one means you're missing a closing bracket somewhere in the last part of the script, Pawno 'thinks' that there should be a continuation to the script, but it can't find it, so it tries to find the closing bracket, but it can't find it either, so it warns you.


Re: Script 2 warnings can't solve it please help me. - Scriptissue - 01.10.2010

Still doesn't work, I don't know what to do.
PHP код:
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\filterscripts\slap.pwn(186) : error 029invalid expressionassumed zero
C
:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\filterscripts\slap.pwn(186) : error 004: function "giveweaponstohim" is not implemented
C
:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\filterscripts\slap.pwn(203) : error 030compound statement not closed at the end of file (started at line 177
New code:
PHP код:
forward giveweaponstohim(otherIdgunIDgunAmmo);
CMD:gw(playeridparams[])
{
if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF4646FF"You are not authorized to use that command !");
else
{
  new 
otherId;
  new 
sendername[MAX_PLAYER_NAME];
  new 
giveplayer[MAX_PLAYER_NAME];
  new 
string[256];
  if(
sscanf(params"u"otherId)) return SendClientMessage(playerid0xAFAFAFAA"USAGE: /gw [PlayerID/PartOfName] [Weapon ID] [Ammo]");
  
format(stringsizeof(string), "* You Jailed %s."giveplayer);
  
SendClientMessage(playeridCOLOR_LIGHTREDstring);
 if(
otherId == INVALID_PLAYER_ID) return SendClientMessage(otherId0xAFAFAFAA"Invalid Player ID");
   {
{
new 
gunID GetPlayerWeapon(playerid);
new 
gunAmmo GetPlayerAmmo(playerid);
GetPlayerName(playeridsendernamesizeof(sendername));
if(
gunID != && gunAmmo != 0)
{
public 
giveweaponstohim(otherIdgunIDgunAmmo);
{
GetPlayerName(playeridsendernamesizeof(sendername)); 
format(stringsizeof(string), "* You have been given a weapon by Admin %s "sendernamegunIDgunAmmo );
                
SendClientMessage(playerid0xFF4646FFstring);
}
        }
    return 
1;




Re: Script 2 warnings can't solve it please help me. - mmrk - 01.10.2010

pawn Код:
CMD:gw(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF4646FF, "You are not authorized to use that command !");
    new otherId, sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], string[128], weaponid, ammo;

    if(sscanf(params, "u", otherId, weaponid, ammo)) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /gw [PlayerID/PartOfName] [Weapon ID] [Ammo]");
    if(otherId == INVALID_PLAYER_ID) return SendClientMessage(otherId, 0xAFAFAFAA, "Invalid Player ID");
    if(weaponid < 0 || weaponid > 50) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Wrong weapon id.");
   
    GivePlayerWeapon(otherId, weaponid, ammo); // Give weapon
    GetPlayerName(playerid, sendername, sizeof(sendername));  
   
    format(string, sizeof(string), "* You have been given a weapon by Admin %s ", sendername);
    SendClientMessage(playerid, 0xFF4646FF, string);
    return 1;
}



Re: Script 2 warnings can't solve it please help me. - Scriptissue - 01.10.2010

Works, now how can I define the names of the weapons I want to give ? what next when I use the command It doesn't give anything.


Re: Script 2 warnings can't solve it please help me. - Scriptissue - 01.10.2010

Anyone please help me ?


Re: Script 2 warnings can't solve it please help me. - Memoryz - 01.10.2010

The weapons are given by IDs.

To see them -> https://sampwiki.blast.hk/wiki/Weapons


Re: Script 2 warnings can't solve it please help me. - SAW-RL - 01.10.2010

GivePlayerWeapon(playerid,weaponid);

Thats it.


Re: Script 2 warnings can't solve it please help me. - Scriptissue - 01.10.2010

I did try to write the ID and the ammo it doesn't work it just shows me a message they admin gave me a weapon but I can't see the weapon do I have to define the weapons ? Enum ?
this is the whole code :
PHP код:
CMD:gw(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF4646FF"You are not authorized to use that command !");
    new 
otherIdsendername[MAX_PLAYER_NAME], string[128], weaponidammo;
    if(
sscanf(params"u"otherIdweaponidammo)) return SendClientMessage(playerid0xAFAFAFAA"USAGE: /gw [PlayerID/PartOfName] [Weapon ID] [Ammo]");
    if(
otherId == INVALID_PLAYER_ID) return SendClientMessage(otherId0xAFAFAFAA"Invalid Player ID");
    if(
weaponid || weaponid 50) return SendClientMessage(playeridCOLOR_GREY"SERVER: Wrong weapon id.");
    
GivePlayerWeapon(otherIdweaponidammo); // Give weapon
    
GetPlayerName(playeridsendernamesizeof(sendername));
    
format(stringsizeof(string), "* You have been given a weapon by Admin %s "sendername);
    
SendClientMessage(playerid0xFF4646FFstring);
    return 
1;




Re: Script 2 warnings can't solve it please help me. - SAW-RL - 01.10.2010

yes you have to define it.
Try it with enums, hm.
Take a look into the godfather