AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help Please (https://forums.alliedmods.net/showthread.php?t=63317)

Reaper2331 11-17-2007 20:05

Help Please
 
ok guys i want to make a plugin for someone that will give CT's a knife and T's 1 smoke and 2 flashes.

i was gonna just edit my other plugin i made for my clan
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Surf Map Weapons"
#define VERSION "1.0"
#define AUTHOR "Reaper2331"


public plugin_init() {
   
register_plugin(PLUGINVERSIONAUTHOR)
   
   new 
mapname[32]
   
get_mapname(mapname31)
   if(
containi(mapname"surf"))
       
register_event("ResetHUD""playerSpawn""be")
}

public 
playerSpawn(id)
{
   
set_task(2.0"checkGuns"id)
}

public 
checkGuns(id)
{
   
strip_user_weapons(id)
   
give_item(id,"weapon_knife")
   
give_item(id,"weapon_deagle")
   
give_item(id,"weapon_kevlar")
   
set_user_health(id100)
   
server_cmd("say [AMXX] Surf Mode Activated you now have a Deagle and kevlar")


but i really dont know how to get a users team and how to do it.

Arkshine 11-17-2007 20:17

Re: Help Please
 
Quote:

but i really dont know how to get a users team and how to do it

get_user_team()

or

cs_get_user_team()

Reaper2331 11-17-2007 20:18

Re: Help Please
 
i read the cs_get_user_team but it confuses me lol, i dont know how to do floats and stuff yet.

Arkshine 11-17-2007 20:26

Re: Help Please
 
Code:
new CsTeams:iTeam = cs_get_user_team( id ); if( iTeam == CS_TEAM_T )     //

Code:

CS_TEAM_UNASSIGNED = 0,
CS_TEAM_T = 1,
CS_TEAM_CT = 2,
CS_TEAM_SPECTATOR = 3


Reaper2331 11-17-2007 20:34

Re: Help Please
 
k thanks

Wilson [29th ID] 11-19-2007 08:07

Re: Help Please
 
#1
if( containi( mapname, "surf" ) )
will not work if the map name begins with surf. Not sure how you crazy cs people do your map names for maps like that, but something like "surf1" will not be detected. The proper way to write that line is:
if( containi( mapname, "surf" ) != -1 )


Anyway, #2,

Code:
public checkGuns(id) {    strip_user_weapons(id)    switch ( cs_get_user_team(id) )    {       case CS_TEAM_T:          give_item( id, "weapon_smoke" );          give_item( id, "weapon_flashbang" );          give_item( id, "weapon_flashbang" );          break;       case CS_TEAM_CT:          give_item( id, "weapon_knife" );          break;    } }

The weapon entity names might be different as I don't play cs. But you get the idea.


All times are GMT -4. The time now is 01:20.

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