Don't work script.
Help me, plz.
This entire script
[CODE]
if ( Player( 1 ):IsUserGroup( "superVIP" ) ) then
pl:Give("weapon", "weapon")
pl:SetMaxHealth(125)
pl:SetHealth(125)
pl:GiveAmmo(100,"pistol")
end
[/CODE]
[IMG]http://i66.fastpic.ru/big/2014/0808/8e/0efaf111cadfbf58fc9006005ed0c48e.jpg[/IMG]
Can you post the whole function? Also, you should really target the player better. Player( 2 ) will only target the second player who joins.
[QUOTE=code_gs;45627051]Can you post the whole function? Also, you should really target the player better. Player( 2 ) will only target the second player who joins.[/QUOTE]
And what function do you want?
[code]
hook.Add("PlayerSpawn", "OpenWide_InComesTheAirplane", function( pl )
if ( pl:IsUserGroup( "superVIP" ) ) then
pl:Give("weapon", "weapon") -- dafuq are you trying to do here
pl:SetMaxHealth(125)
pl:SetHealth(125)
pl:GiveAmmo(100,"Pistol")
end
end)
[/code]
?
[URL="http://wiki.garrysmod.com/page/Player/Give"]PLAYER:Give()[/URL] has only one parameter.
You probably want [B]pl:Give( "weapon_pistol" )[/B] judging by your ammo.
[LUA]if ( Player( 1 ):IsUserGroup( "superVIP" ) ) then
pl:Give("weapon_pistol")
pl:SetMaxHealth(125)
pl:SetHealth(125)
pl:GiveAmmo(100,"pistol")
end
[/LUA]
[QUOTE=AnonTakesOver;45627101][code]
hook.Add("PlayerSpawn", 'OpenWide_InComesTheAirplane", function( pl )
if ( pl:IsUserGroup( "superVIP" ) ) then
pl:Give("weapon", "weapon") -- dafuq are you trying to do here
pl:SetMaxHealth(125)
pl:SetHealth(125)
pl:GiveAmmo(100,"Pistol")
end
end)
[/code]
?[/QUOTE]
Don't work.
[QUOTE=godred2;45627121]Don't work.[/QUOTE]
You're a very descriptive man.
Can you post the error (if there is one?)
Anon did most of the work for you. Use the wiki to look up the player.Give, I guess that needed repeating.
wiki.garrysmod.com
[QUOTE=Mista Tea;45627118][URL="http://wiki.garrysmod.com/page/Player/Give"]PLAYER:Give()[/URL] has only one parameter.
You probably want [B]pl:Give( "weapon_pistol" )[/B] judging by your ammo.
[LUA]if ( Player( 1 ):IsUserGroup( "superVIP" ) ) then
pl:Give("weapon_pistol")
pl:SetMaxHealth(125)
pl:SetHealth(125)
pl:GiveAmmo(100,"pistol")
end
[/LUA][/QUOTE]
Sorry, dont work ((
[QUOTE=godred2;45627202]Sorry, dont work (([/QUOTE]
If you can post exactly how you are trying to use this code, that would really help. Giving us any errors would also be great.
[QUOTE=Mista Tea;45627220]If you can post exactly how you are trying to use this code, that would really help. Giving us any errors would also be great.[/QUOTE]
[IMG]http://i66.fastpic.ru/big/2014/0808/8e/0efaf111cadfbf58fc9006005ed0c48e.jpg[/IMG]
[del]Oh. It's [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]PLAYER:GetUserGroup[/URL], not IsUserGroup.
if ( Player( 1 ):GetUserGroup() == "superVIP" ) then ...
Unless I am missing something deeper.[/del]
My mistake, thanks crazyscouter. PLAYER:IsUserGroup did not show up in the wiki when I searched for "UserGroup". Bad assumption on my part.
[QUOTE=Mista Tea;45627279]Oh. It's [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]PLAYER:GetUserGroup[/URL], not IsUserGroup.
if ( Player( 1 ):GetUserGroup() == "superVIP" ) then ...[/QUOTE]
Would look like the script
please write
IsUserGroup() should work regardless. The op should use LocalPlayer():IsUserGroup(blah) instead( considering he's trying to run it clientside for some reason ), as I see no real reason to use Player(1). Also, you need to make sure the player is initialized before running anything on them, or else you'll get errors like you are. Not to mention OP, you really need to learn how to Google, and use basic Lua syntax before attempting to make anything. You have literally be spoon fed several times throughout this thread.
[IMG]http://i68.fastpic.ru/big/2014/0808/b7/d327294ccb077fb62ded9ffe964da3b7.jpg[/IMG][QUOTE=Mista Tea;45627279][del]Oh. It's [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]PLAYER:GetUserGroup[/URL], not IsUserGroup.
if ( Player( 1 ):GetUserGroup() == "superVIP" ) then ...
Unless I am missing something deeper.[/del]
My mistake. PLAYER:IsUserGroup did not show up in the wiki when I searched for "UserGroup". Bad assumption on my part.[/QUOTE]
[editline]8th August 2014[/editline]
[QUOTE=crazyscouter;45627302]IsUserGroup() should work regardless. The op should use LocalPlayer():IsUserGroup(blah) instead( considering he's trying to run it clientside for some reason ), as I see no real reason to use Player(1). Also, you need to make sure the player is initialized before running anything on them, or else you'll get errors like you are. Not to mention OP, you really need to learn how to Google, and use basic Lua syntax before attempting to make anything. You have literally be spoon fed several times throughout this thread.[/QUOTE]
What to do then?
Omfg op. Let me just write the whole damn script for you.
[code]
local vip = {};
vip['superVIP'] = true;
vip['vip'] = true;
vip['donator'] = true;
hook.Add("PlayerSpawn", "PlayerSpawn:VIPPerks", function(ply)
local g = ply:GetUserGroup();
if (vip[g]) then
ply:Give("weapon_pistol");
ply:SetMaxHealth(125);
ply:SetHealth(125);
ply:GiveAmmo(100, "pistol");
end
end)
[/code]
*cough* server side *cough*
Literally took me five minutes. If you would have googled a bit, and tried to make it yourself, I guarantee you wouldn't have wasted an hour on this thread.
[QUOTE=Mista Tea;45627279][del]Oh. It's [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]PLAYER:GetUserGroup[/URL], not IsUserGroup.
if ( Player( 1 ):GetUserGroup() == "superVIP" ) then ...
Unless I am missing something deeper.[/del]
My mistake, thanks crazyscouter. PLAYER:IsUserGroup did not show up in the wiki when I searched for "UserGroup". Bad assumption on my part.[/QUOTE]
Write please a script.
What at the spawn at the player with ADMIN nickname spawn the weapon.
[QUOTE=crazyscouter;45627362]Omfg op. Let me just write the whole damn script for you.
[code]
local vip = {};
vip['superVIP'] = true;
vip['vip'] = true;
vip['donator'] = true;
hook.Add("PlayerSpawn", "PlayerSpawn:VIPPerks", function(ply)
local g = ply:GetUserGroup();
if (vip[g]) then
ply:Give("weapon_pistol");
ply:SetMaxHealth(125);
ply:SetHealth(125);
end
end)
[/code]
*cough* server side *cough*[/QUOTE]
Don't forget about the ammo ;) OP will not be able to add it himself.
[QUOTE=Mista Tea;45627373]Don't forget about the ammo ;) OP will not be able to add it himself.[/QUOTE]
Almost forgot! The most important part ofc.
[QUOTE=Mista Tea;45627373]Don't forget about the ammo ;) OP will not be able to add it himself.[/QUOTE]
The weapon isn't given.
Mistakes aren't present.
[editline]8th August 2014[/editline]
[QUOTE=crazyscouter;45627362]Omfg op. Let me just write the whole damn script for you.
[code]
local vip = {};
vip['superVIP'] = true;
vip['vip'] = true;
vip['donator'] = true;
hook.Add("PlayerSpawn", "PlayerSpawn:VIPPerks", function(ply)
local g = ply:GetUserGroup();
if (vip[g]) then
ply:Give("weapon_pistol");
ply:SetMaxHealth(125);
ply:SetHealth(125);
ply:GiveAmmo(100, "pistol");
end
end)
[/code]
*cough* server side *cough*
Literally took me five minutes. If you would have googled a bit, and tried to make it yourself, I guarantee you wouldn't have wasted an hour on this thread.[/QUOTE]
The weapon isn't given.
Mistakes aren't present.
Where are you placing this?! On your client ( and running in listen mode? ) or on a server ( dedi )?
[QUOTE=scottd564;45627483]Where are you placing this?! On your client ( and running in listen mode? ) or on a server?[/QUOTE]
Server Ded.
MOD - SandBox
My script worked fine, the problem was I was an idiot and for the hook I did this
'OpenWide_InComesTheAirplane"
you see it? I used ' to begin and " to end the string.
Sorry, hard to notice it, I didn't realize.
Sorry, you need to Log In to post a reply to this thread.