Raised This Month: $51 Target: $400
 12% 

undefined symbol "GivePlayerItem"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hay
Junior Member
Join Date: Jun 2018
Old 06-09-2018 , 09:07   undefined symbol "GivePlayerItem"
Reply With Quote #1

Can Someone Tell me whats the problem here?

Quote:
public Action:Command_AK(client,args)
{
PrintToChat(client, "\x07Getting Deagle...");
void CS_DropWeapon;
GivePlayerItem(client, "Weapon_DEAGLE");
GivePlayerAmmo(client, 1, "Weapon_DEAGLE", true);
GivePlayerItem(client, "Weapon_FLASHBANG");
}
Errors-

undefined symbol "GivePlayerItem"
undefined symbol "GivePlayAmmo"
undefined symbol "GivePlayerItem"
Hay is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 06-09-2018 , 09:20   Re: undefined symbol "GivePlayerItem"
Reply With Quote #2

Code:
#include <sdktools>
https://sm.alliedmods.net/new-api/sd...GivePlayerItem
__________________
coding & free software
shanapu is offline
Hay
Junior Member
Join Date: Jun 2018
Old 06-09-2018 , 09:31   Re: undefined symbol "GivePlayerItem"
Reply With Quote #3

Quote:
Originally Posted by shanapu View Post
tnx done but now I have other problems, you might look at the full code :
Quote:
#include <sourcemod>
#include <sdktools>
public void OnPluginStart()
{
RegAdminCmd("sm_deagle", Command_Deagle, ADMFLAG_SLAY, "Deagle");
}

public Action:Command_Deagle(client,args)
{
PrintToChat(client, "\x07Getting Deagle...");
void CS_DropWeapon;
GivePlayerItem(client, "Weapon_DEAGLE");
GivePlayerAmmo(client, 1, "Weapon_DEAGLE", true);
GivePlayerItem(client, "Weapon_FLASHBANG");
}
Error :

argument type mismatch (argument 3)
Hay is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 06-09-2018 , 11:47   Re: undefined symbol "GivePlayerItem"
Reply With Quote #4

Your code is very messy. You should look into proper formatting before making a thread for every error you get. Also, please make a habit of telling us exactly what the errors are and pinpointing the lines in which those errors occur. It would make things way easier for everyone.
__________________
Psyk0tik is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 06-09-2018 , 18:31   Re: undefined symbol "GivePlayerItem"
Reply With Quote #5

I always recommend taking a look at existing plugins with similar features.
When you need an example how to implement a function/forward you found on sourcemod API Reference try a github/gitlabs search for examples (even when they sometimes not the best) it's a good start for understanding the usage of some functions.

When you new to sourcepawn you should imho definitely start writing code in new SourcePawn Transitional Syntax.

As I see the problem with your code above was "solved" in an other thread.
please when open a new thread put some afford in creating a meaningful topic - "help with code", "little help" are no descriptive titles.
__________________
coding & free software
shanapu is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-10-2018 , 03:01   Re: undefined symbol "GivePlayerItem"
Reply With Quote #6

What are you trying to do exactly?
mug1wara is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-10-2018 , 03:23   Re: undefined symbol "GivePlayerItem"
Reply With Quote #7

PHP Code:
#include <sourcemod>
#include <sdktools> // Muy importante. ^_ ^

#pragma semicolon 1
#pragma newdecls required // Checking if the new syntax is correct.

public void OnPluginStart()
{
    
RegAdminCmd("sm_deagle"Cmd_DeagleADMFLAG_SLAY);
}

public 
Action Cmd_Deagle(int iClientint sArgs)
{
    
int iWeapon GetPlayerWeaponSlot(iClient2); // Getting player weaponslot.
    
    
RemovePlayerItem(iClientiWeapon); // Remove the client's weapon.
    
AcceptEntityInput(iWeapon"kill"); // Remove the client's weapon.
    
    
GivePlayerItem(iClient"weapon_deagle"); // Give the client a deagle.
    
    
SetEntProp(iClientProp_Data"m_iAmmo"1); // GivePlayerAmmo gives + ammo, it doesn't set the ammo. Therefore do like this.
    
    
return Plugin_Handled// Stop.


Last edited by mug1wara; 06-10-2018 at 03:24.
mug1wara is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 06-10-2018 , 14:41   Re: undefined symbol "GivePlayerItem"
Reply With Quote #8

if you want to set the ammo into the clip you need to A) set it on the weapon and B) set m_iClip1 not m_iAmmo as this is an array where you set 1 bullet to m_iAmmo index 0. Aka m_iAmmo[0] = 1;
xerox8521 is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 04:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode