TF2 Request Sentry Spawner
Hi everyone this is my first noob post here! Sorry for my incompetence but i have the code to do this i just dont know how to put it all together to make it work i know i'm missing a few lines of code due to the errors when i try to compile it.
currently the code i have is: #include <sourcemod> #include <dbi> #include <timers> #include <events> #include <clients> #include <sdktools> new Float:ori[3]; public Plugin:myinfo = { name = "bla", author = "bla", description = "bla", version = "bla", url = "bla" }; public OnPluginStart() { RegConsoleCmd("say", Command_Say); } public Action:Command_Say(client, args) { new String:text[192]; GetCmdArg(1,text,sizeof(text)); if ( StrEqual(text,"sentry") ) { //time to move away GetClientAbsOrigin(client,ori); CreateTimer(1.0,BuildSentry,client); return Plugin_Handled; } return Plugin_Continue; } public Action:BuildSentry(iBuilder, Float:fOrigin[3], Float:fAngle[3], iLevel=1) { new Float:fBuildMaxs[3]; fBuildMaxs[0] = 24.0; fBuildMaxs[1] = 24.0; fBuildMaxs[2] = 66.0; new Float:fMdlWidth[3]; fMdlWidth[0] = 1.0; fMdlWidth[1] = 0.5; fMdlWidth[2] = 0.0; new String:sModel[64]; new iTeam = GetClientTeam(iBuilder); new iShells, iHealth, iRockets; iShells = iHealth = iRockets; if(iLevel == 1) { sModel = "models/buildables/sentry1.mdl"; iShells = 100; iHealth = 150; } else if(iLevel == 2) { sModel = "models/buildables/sentry2.mdl"; iShells = 120; iHealth = 180; } else if(iLevel == 3) { sModel = "models/buildables/sentry3.mdl"; iShells = 144; iHealth = 216; iRockets = 20; } new iSentry = CreateEntityByName("obj_sentrygun"); DispatchSpawn(iSentry); TeleportEntity(iSentry, fOrigin, fAngle, NULL_VECTOR); SetEntityModel(iSentry,sModel); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_flAnim Time"), 51, 4 , true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_nNewSe quenceParity"), 4, 4 , true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_nReset EventsParity"), 4, 4 , true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iAmmoS hells") , iShells, 4, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iMaxHe alth"), iHealth, 4, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iHealt h"), iHealth, 4, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_bBuild ing"), 0, 2, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_bPlaci ng"), 0, 2, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_bDisab led"), 0, 2, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iObjec tType"), 3, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iState "), 1, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iUpgra deMetal"), 0, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_bHasSa pper"), 0, 2, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_nSkin" ), (iTeam-2), 1, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_bServe rOverridePlacement"), 1, 1, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iUpgra deLevel"), iLevel, 4, true); SetEntData(iSentry, FindSendPropOffs("CObjectSentrygun","m_iAmmoR ockets"), iRockets, 4, true); SetEntDataEnt2(iSentry, FindSendPropOffs("CObjectSentrygun","m_nSeque nce"), 0, true); SetEntDataEnt2(iSentry, FindSendPropOffs("CObjectSentrygun","m_hBuild er"), iBuilder, true); SetEntDataFloat(iSentry, FindSendPropOffs("CObjectSentrygun","m_flCycl e"), 0.0, true); SetEntDataFloat(iSentry, FindSendPropOffs("CObjectSentrygun","m_flPlay backRate"), 1.0, true); SetEntDataFloat(iSentry, FindSendPropOffs("CObjectSentrygun","m_flPerc entageConstructed"), 1.0, true); SetEntDataVector(iSentry, FindSendPropOffs("CObjectSentrygun","m_vecOri gin"), fOrigin, true); SetEntDataVector(iSentry, FindSendPropOffs("CObjectSentrygun","m_angRot ation"), fAngle, true); SetEntDataVector(iSentry, FindSendPropOffs("CObjectSentrygun","m_vecBui ldMaxs"), fBuildMaxs, true); SetEntDataVector(iSentry, FindSendPropOffs("CObjectSentrygun","m_flMode lWidthScale"), fMdlWidth, true); SetVariantInt(iTeam); AcceptEntityInput(iSentry, "TeamNum", -1, -1, 0); SetVariantInt(iTeam); AcceptEntityInput(iSentry, "SetTeam", -1, -1, 0); } i referenced this post for the above code by The JCS and Tauphi http://forums.alliedmods.net/showthread.php?t=64609 i know the problem has something to do with the 2nd "public action" line but i have no idea how to put both BuildSentry(Handle:timer,any:client)and BuildSentry(iBuilder, Float:fOrigin[3], Float:fAngle[3], iLevel=1) in the script any help would be immensly appreciated! Thank You |
| All times are GMT -4. The time now is 03:45. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.