AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check If SteamID is Connected (https://forums.alliedmods.net/showthread.php?t=210825)

3xit. 03-15-2013 03:31

Check If SteamID is Connected
 
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.

fysiks 03-15-2013 03:34

Re: Check If SteamID is Connected
 
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.

3xit. 03-15-2013 03:42

Re: Check If SteamID is Connected
 
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); 
}
}



fysiks 03-15-2013 03:58

Re: Check If SteamID is Connected
 
Quote:

Originally Posted by 3xit. (Post 1912951)
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



3xit. 03-15-2013 04:06

Re: Check If SteamID is Connected
 
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)
}



Leon M. 03-15-2013 04:29

Re: Check If SteamID is Connected
 
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.


All times are GMT -4. The time now is 21:41.

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