Raised This Month: $ Target: $400
 0% 

Check If SteamID is Connected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
3xit.
Junior Member
Join Date: Nov 2012
Old 03-15-2013 , 03:31   Check If SteamID is Connected
Reply With Quote #1

Hello, What i am trying to do is to check if STEAMID is in the server.
If not the item is disabled.

PHP Code:
gVoteMenu menu_create("\yWeekend Menu :""Vote_Handler"); 
menu_additem(gVoteMenu"Speed Knifing""0"0); 
menu_additem(gVoteMenu"Grenade War""1"0); 
menu_additem(gVoteMenu"Ninja Day""2"0);
if( 
equalszAuth"STEAM_0:1:56216636" ) ) menu_additem(gVoteMenu"/wKill Player Day""3"0);
else 
menu_additem(gVoteMenu"\dKill Player Day""3"0); 
Cant get it to work. Help will be appreciated.

Last edited by 3xit.; 03-15-2013 at 03:36.
3xit. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2013 , 03:34   Re: Check If SteamID is Connected
Reply With Quote #2

Show the whole code (where is szAuth coming from?).

You can look for player via cmd_target() using name, userid, or authid. It will return 0 if not found.
__________________
fysiks is offline
3xit.
Junior Member
Join Date: Nov 2012
Old 03-15-2013 , 03:42   Re: Check If SteamID is Connected
Reply With Quote #3

Im pretty sure i got alot of code missing.

PHP Code:
new szAuth35 ]; 
PHP Code:
public StartVote(id

if( 
gVoting 

client_print(idprint_chat"There is already a vote going."); 
return 
PLUGIN_HANDLED

gVoteMenu menu_create("\yWeekend Menu :""Vote_Handler"); 
menu_additem(gVoteMenu"Speed Knifing""0"0); 
menu_additem(gVoteMenu"Grenade War""1"0); 
menu_additem(gVoteMenu"Ninja Day""2"0);
if( 
equaliszAuth"STEAM_0:1:56216636" ) ) menu_additem(gVoteMenu"/wKill Player Day""3"0);
else 
menu_additem(gVoteMenu"\dKill Player Day""3"0);
new 
players[32], pnumtempid
get_players(playerspnum); 
for( new 
ii<pnumi++ ) 

tempid players[i]; 
menu_display(tempidgVoteMenu0); 
gVoting++; 

set_task(10.0"EndVote"); 
return 
PLUGIN_HANDLED

PHP Code:
case 3:
{
if( 
equaliszAuth"STEAM_0:1:56216636" ) )
{
ShowVotes(id)
touch_weapons[id] = true
ColorChat
(0RED"^x04%s^x01 ^x03%s^x01 Has Voted For^x03 Kill Player Day",prefixszName); 
}
else if( !
equaliszAuth"STEAM_0:1:56216636" ) )
{
ColorChat(0RED"^x04%s^x01 You Cannot Pick This Day",prefix); 
}
}

3xit. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2013 , 03:58   Re: Check If SteamID is Connected
Reply With Quote #4

Quote:
Originally Posted by 3xit. View Post
Im pretty sure i got alot of code missing.
Clearly because you didn't post the whole code.

Anyways, to check if a player is in the server, you can use find_player():

PHP Code:
if( find_player("c""STEAM_0:1:23456") )
{
    
// Player is in the server

__________________
fysiks is offline
3xit.
Junior Member
Join Date: Nov 2012
Old 03-15-2013 , 04:06   Re: Check If SteamID is Connected
Reply With Quote #5

Thanks just one more question. If i want something to happen just to that steam id
will this code work.

PHP Code:
if( find_player("c""STEAM_0:1:56216636") ) 
{
strip_user_weapons(id)
set_user_godmode(id0)
}

3xit. is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 03-15-2013 , 04:29   Re: Check If SteamID is Connected
Reply With Quote #6

find_player returns on success users index otherwise 0 (or false)

So your code should look like
PHP Code:
new iPlayer find_player("c""STEAM_0:1:23456789")
if(
iPlayer){
    
strip_user_weapons(iPlayer)
    
set_user_godmode(iPlayer0)

I also can assume that you want to troll an user on your server ^^ That's not nicely.
__________________
  • ZapTic - Paintball (Version 7.1.3 b1303)
  • Your #1 CS Paintball Server since 2008
  • 85.131.163.101:27015

Last edited by Leon M.; 03-15-2013 at 04:33.
Leon M. 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 21:41.


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