Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - [TDA]Speed

#1
what this function used for ?
this function used to give the player ammo or weapon without changing his current weapon

GiveAmmoToWeapon(player, WeaponID, ammo);


place this function anywhere
function GiveAmmoToWeapon(player, weapon, amount)
{
local currentwep = player.Weapon;
local currentammo = player.GetAmmoAtSlot(player.Slot);
local weapon = weapon;
amount = amount;
player.GiveWeapon(weapon,amount);
if (currentwep != weapon ) player.SetWeapon(currentwep,currentammo);
}


example usage

if (player.GetWeaponAtslot(6) == 26) GiveAmmoToWeapon(player, 26, 30);

if player holding shotgun and picked m4 it will not change his weapon and will give him ammo for m4 without changing his weapon
#2
Quote from: habi2 on Feb 05, 2025, 03:53 PM
Quote from: [TDA]Speed on Feb 04, 2025, 04:42 PMHello hapi, i wonder if you will add something like Npc.Walkto and Npc.Run like normal player walking and running because walktopoint is walking without anim and not so perefct i hope you added these two

I understand you want npc.walkto( position ) and npc.run( ) like normal player walking and running. It would be great to have it pre-built.

i will check if anything can be done about this issue.
alright, thank you
#3
Tutorials / Re: Walking npc
Feb 05, 2025, 11:54 AM


target<-null;timerid<-null;
WALK_START <- Vector(-872.146, -431.502, 11.5288);
WALK_END <- Vector( -870.825, -296.79, 11.173);
walking <- false;
reached <- false;
function WalkToPoint(point)
{
target=point;
if(timerid==null)
{
timerid=SetTimerEx("step_forward",100,0);
        //Remotely calling functions 'compilestring' of server.
RFC(F("compilestring")("function SetWalkingAnimation(id){ local p=FindPlayer(id); if(p && IsPlayerNPC(id))p.SetAnim(0,0);else WalkTimer"+GetMyID()+".Delete()}"))();
RFC(F("compilestring")("WalkTimer"+GetMyID()+"<-NewTimer(\"SetWalkingAnimation\",100,0,"+GetMyID()+")"))();
}
}

function Walk(pos)
{
walking = true;
target = pos;
local lastpos= GetMyPos();
local newpos= pos;
local z=FindZFor2DCoord(newpos.x, newpos.y);
if(!z)
{
Stop();
return;
}
else newpos.z=z+ 0.5; //Update z co-ordinate so that npc do not float in air/fall down.

//Check wall, etc.
if(newpos.z-lastpos.z > 0.5)
{
//cannot move forward
Stop();
SendChat("I can't go further");
print("the jump is "+(newpos.z-lastpos.z)+" to "+newpos+" from "+lastpos+"\n");
return
}
//step_forward()
SetLocalValue(F_ANGLE, atan2(-(target.x - GetMyPosX()), target.y - GetMyPosY()));
//SetLocalValue(F_POSX,newpos.x);
//SetLocalValue(F_POSY,newpos.y);
//SetLocalValue(F_POSZ,newpos.z);
SetLocalValue(I_KEYS, KEY_ONFOOT_FORWARD)
SetLocalValue(V_ONFOOT_SPEED, (newpos-lastpos).Normalised()*0.12688)
move2(lastpos,GetMyFacingAngle(), 0.22,0)
SendOnFootSyncDataLV()
//if( GetDistanceFromMeToPoint( target ) < 1 )
//{
//SetMyPos(target);
//Stop();
//}
}

function Stop()
{
if(timerid!=null)
KillTimer(timerid)
//Send stationary-npc packet (stop walking)
SetLocalValue(I_KEYS, 0)
SetLocalValue(V_ONFOOT_SPEED, Vector(0,0,0))
SendOnFootSyncDataLV()
walking = false;
}

function onDestinationReached()
{
if( GetDistanceFromMeToPoint( WALK_START ) < 2 )
WalkToPoint( WALK_END );
else if( GetDistanceFromMeToPoint( WALK_END ) < 2 )
{
WalkToPoint( WALK_START );
        //print something on server console.
RFC("print")("npc: i completed one round of patrol");
}
}
function step_forward()
{
local newpos=GetMyPos()+(target-GetMyPos()).Normalised()*0.14;
newpos.z=FindZFor2DCoord(newpos.x, newpos.y)+1.0425;
//SetLocalValue(V_POS, newpos);
SetLocalValue(F_ANGLE, atan2(-(target.x-GetMyPosX()),target.y-GetMyPosY()));
//if((target-GetMyPos()).Length()<0.8)//reached destination
////{
//if(timerid!=null)
// KillTimer(timerid);
//timerid=null;
//stop timer of server
//RFC(F("compilestring")("WalkTimer"+GetMyName()+".Delete()"))();
//}
//else SendOnFootSyncDataLV();
//if(timerid==null)
//onDestinationReached();
}
function OnNPCSpawn()
{
//SetTimerEx("SetMyPos",700, 1, WALK_START );
// SetMyPos(WALK_START);
//print(GetMyPos());
//SetTimerEx("Walk", 1000, 1 );
//WalkToPoint( WALK_END );
//Acquire weapon and skin
RFC(F("compilestring")("FindPlayer("+GetMyID()+").SetWeapon(4,1);"))();
RFC(F("compilestring")("FindPlayer("+GetMyID()+").Skin=1"))();
//SetTimerEx("SetLocalValue", 1000,1, I_CURWEP, 4);
//if( GetDistanceFromMeToPoint( pos ) < 2 ) WalkToPoint( pos );
SetTimerEx("checktowalk", 1000, 0 );
}

function checktowalk()
{
local msg;
    local name;
local pos;
local Distance;
local x;
local num_streamed_in = 0;
local num_connected = 0;
x=0;
while(x!=MAX_PLAYERS) {
    if(IsPlayerConnected(x)) {
        num_connected++;
        if(IsPlayerStreamedIn(x)) {
            num_streamed_in++;
        name=GetPlayerName(x);
pos=GetPlayerPos(x);
Distance=GetDistanceFromMeToPoint(pos);
if (Distance < 30) if (walking == false && reached == false) Walk(pos);
if (Distance > 35) Stop();
//if (Distance < 1)
//{
//SetMyPos(x.pos);
//walking = false;
//reached == true;
//}
if (Distance > 2 && reached == true)
{

walking = false;
reached == false;
}

if(GetPlayerState(x) == PLAYER_STATE_DRIVER) {
    msg=format("I see %s driving vehicle: %d",name,GetPlayerVehicleID(x));
SendChat(msg);
}

}
}
x++;
};
}

function OnNPCScriptLoad(params)
{
if(!MiamiScale_Init("default.map"))
{
SendChat("My map is not loaded. Bye");
QuitServer();
}
}
function OnNPCScriptUnload()
{
MiamiScale_Unload();
}



#4
Tutorials / Re: Walking npc
Feb 05, 2025, 11:52 AM
i made this one but the problem npc's location not updated after move if i used /loc it will show the npc's last location the pos he was standing and if i move away he will back again to his last pos so how to sync npc.pos to server
#5
Quote from: MEGAMIND on Feb 04, 2025, 05:06 PM
Quote from: [TDA]Speed on Feb 04, 2025, 04:42 PMHello hapi, i wonder if you will something like Npc.Walkto and Npc.Run like normal player walking and running because walktopoint is walking without anim and not so perefct i hope you added these two

u can set anim on walk amd timers.. theres example in npc wiki, same goes for running
not perfect you can see sometimes will sure missed because timers and anims i meant like normal npcs walk exmple in offline game walking smoothly
#6
Hello hapi, i wonder if you will add something like Npc.Walkto and Npc.Run like normal player walking and running because walktopoint is walking without anim and not so perefct i hope you added these two
#7
Servers / Vice City Gang Wars
Jan 27, 2025, 02:05 PM
Server Ip: 57.129.44.185:8205
Gamemode: Gang Wars
Player Slots: 100
Server Discord:  https://discord.com/invite/smKGNRrPpX
Server Facebook: https://www.facebook.com/profile.php?id=61572470734595

Credits:
Snow
Speed
Xann/Ridbrine(old staff)
EgyKing
special thanks: H.a.s.a.n, GTA MODS( Ahmad412 ), Sebastian.

Beta Testers: [KF]Adhem, H.a.s.a.n, [RT]Claude_Speed,  [TDAt]Sonny^Forelli


Game Mode Explations

 **Core Features** 
- **Gang Wars & Zones**: Gangs can attack zones to dominate them, increasing their resources, vehicles, and influence. 
- **Police System**: Officers can arrest wanted players by knocking them down and pressing B nearby. Police have special cars accessible via /copcar. 
- **Gang Vehicles**: Gangs can spawn vehicles using !getgangcar and expand their fleet by controlling more zones and boatyards. 

 **Missions** 
1. **Bank Robbery**: Requires a drill (bought from city scrap near the Haitian base). A teammate can sync the mission. Destroy the safe with a bomb after drilling. If a robber dies or leaves, police can retrieve the dropped loot for a reward. 
2. **Boatyard Attack**: Requires Yacht Zone control. Attacking boatyards provides gang weapon storage (M4, AK47, RPG, etc.). 
3. **RC Van Bombing**: Requires teamwork. Enter an RC Van near the construction site and place four bombs inside a building. Success grants 800 gang score. 
4. **Cubans vs. Haitians**: Infiltrate the Haitian base disguised as a Fake Haitian, plant bombs, and destroy the base for 10 minutes. 

 **Additional Features** 
- **Gang Leaders & Ranks**: Requires 2000 kills in a gang to play as a leader; 1000 kills for an Underboss. 
- **VIP System**: Earn GW (Gang War currency) through daily missions to buy VIP, which grants a Rifle, extra HP, and armor. 
- **Weapons & Storage**: Some purchased weapons (M4, AK47, Ruger) persist through deaths but are lost on exit. Yacht missions add 30 pickups per weapon to gang storage. 
- **Vehicle Traps**: Install car bombs using the 8-Ball system, detonated remotely. 
- **Heli-Killing**: Enabled only when a zone is under attack. 
- **Drive-by**: Enabled only when a zone is under attack and while having a teammate in the vehicle. 
- **Kidnapping**: Gangs can kidnap players if they control the Kidnap Base and have an empty seat in a 3-seat vehicle. 
- **Bank Van Robbery**: Enter the bank van and drive it to the gang base to steal money. 
- **Army Mechanics**: Military forces can use Rhinos (Tanks) & Hydras. They can buy and load bombs onto Hydras to attack Yachts & players. 
- **Daily Missions**: Players can do daily missions, for example, spray 20 graffiti tags. They can gain GW, which can be used to buy VIP. 
- **Gang Skins**: Players can choose skins for certain gangs, for example, Bikers. If you press Arrow Up with the third gangster on the spawn screen, the skin will change. 
- **Weapons**: Players can buy weapons from Ammu-Nation. If you buy any rifle, for example, an M4, it will be saved even if you die. The same applies to the Spas, but you must write /spawnwep sp to be able to spawn with it. 

 **Balance & Restrictions** 
- **Team Markers**: Only visible if the server has more than 5 players, unless a zone is under attack. 
- **Preventing Yacht Missions**: Players can stop a Yacht Mission by shooting it, especially with an RPG at the center. 

The server is built to resemble GTA San Andreas Gang Wars, blending San Andreas-style turf wars with additional police, military, and mission mechanics.

Server Commands

 **1. General & Account Cmds** 
- **Server Cmds**: Manage accounts, VIP purchases, and admin interactions (/changepassword, /admins, /country, /level, /msg, /buyvip, /viptime, /helpcmd). 
- **Money Cmds**: Handle transactions (/money, /pay, /withdraw, /deposit). 
- **Stats & Info Cmds**: View and manage player stats (/hp, /loc, /ping, /fps, /afk, /stats, /setstats, /spec, /ignore, /report). 

 **2. Vehicles & Transportation** 
- **Gang & Police Vehicles**: Spawn cars for gangs and police (/gangcars, /copcar, !getgangcar). 
- **Additional Vehicle Features**: (Commented-out but possibly available: /getcar, /sharecar, /delsharecar, /carcol, /park). 

 **3. Combat & Weapons** 
- **Weapon Management**: Equip, drop, and reset weapons (/spawnwep, /dropweapon, /delwep, /disarm). 
- **Saved Weapons**: Manage saved weapon collections (/savedelwepcolt, /delsavewepcolt). 

 **4. Gangs & Territory** 
- **Gang System**: Manage gang memberships and territories (/ganginfo, /gang, /requestjoin, /cancelrequest, /leavegang, /zones). 

 **5. Police & Law Enforcement** 
- **Police Actions**: Use police vehicles, buy bombs, and arrest criminals (/copcar, /buybombs, /loadbombs, B to arrest). 
- **Wanted System**: Check wanted players (/w). 

 **6. Missions & Heists** 
- **Major Missions**: Attack boatyards, rob banks, and buy necessary equipment (/attackboatyard, /buydrill, /buybomb, /bankrob). 
- **Item Handling**: Manage mission-related items (/dropdrill, /dropmoneybag, /placedrill, /placebomb). 

 **7. Miscellaneous Features** 
- **Animations**: Perform in-game animations (/a, /talkinganim). 
- **Server Info**: Access game-related details (/serverinfo, /credits). 
#8
Oh okey thanks
#9
sorry but i dont understand this plugin allows you to use client side scripts with normal server scripts ?
#10
thank you for this
#11
i dont think its a good thing for some players or not but some players who have a slow bad internet will not abel to join some servers for online store files example RTV server when i join it every time it say http timeout or something like that i think the old way to store files was better or maybe make a vote to see if vcmp community players like it or no
VCMP was the only game i play because its not require high speed internet (my net speed some times be lower then 250 kb)
i hope you guys understand me,
try to keep vcmp for poor peoples  :)
#12
General Discussion / Re: Some Suggestions
Nov 13, 2024, 07:34 AM
Quote from: vitovc on Nov 12, 2024, 03:44 PM
Quote from: [TDA]Speed on Nov 12, 2024, 08:22 AMbut why scripting it while its already available in the offline game
because it is not available in vc-mp as built-in function
Quote from: [TDA]Speed on Nov 12, 2024, 08:22 AMi have tried many things like attaching player to vehicle but this not working
for me it was worked (not perfect but worked) so it depends of scripter
yes of course but we can easily add the feature from the original game it will be better
#13
Tutorials / Re: Walking npc
Nov 12, 2024, 08:27 AM
Quote from: MEGAMIND on Nov 10, 2024, 04:16 PM
Quote from: [TDA]Speed on Nov 10, 2024, 04:12 PM
Quote from: MEGAMIND on Nov 10, 2024, 10:30 AM
Quote from: [TDA]Speed on Nov 10, 2024, 09:30 AM
Quote from: vitovc on Nov 04, 2024, 06:44 PMit is possible but he wants you to code pathfinding for him xD
actually there is alot of AI-stuff can be done (and needed for DM-gamemods). I feel fear when I imagine how much work should be done to make npc to act like real players in terms of DM.
maybe we can make something more easliy then this like know the nearest pos of npc and walk to it

i did it eventaully u can do it too, get the nearest player id from distanceotpoint and walk it there.. an example here it moves twoards the loaction of player where ever it is going
Quote from: MEGAMIND on Nov 10, 2024, 10:30 AM
Quote from: [TDA]Speed on Nov 10, 2024, 09:30 AM
Quote from: vitovc on Nov 04, 2024, 06:44 PMit is possible but he wants you to code pathfinding for him xD
actually there is alot of AI-stuff can be done (and needed for DM-gamemods). I feel fear when I imagine how much work should be done to make npc to act like real players in terms of DM.
maybe we can make something more easliy then this like know the nearest pos of npc and walk to it

i did it eventaully u can do it too, get the nearest player id from distanceotpoint and walk it there.. an example here it moves twoards the loaction of player where ever it is going
lool man thats awsome! nick work
u cant test that npc.ai at my server more of that want in depth knowledge ? https://forum.vc-mp.org/index.php?topic=3350.msg54387#new
okey brother thanks for link, you asking or suggesting? xD
#14
Quote from: MEGAMIND on Oct 29, 2024, 11:11 AM
Quote from: [TDA]Speed on Oct 29, 2024, 10:44 AMthats a good thing really imagine an AI npc with habis npcs plugins and AI of chatgpt

a.i npc gonna take ober every server and kill the shit out of users, pro npc 😅

actually got inspired by

so thought why not one for vcmp
yes but the problem is its need alot of work alot alot..
#15
General Discussion / Re: Some Suggestions
Nov 12, 2024, 08:22 AM
Quote from: vitovc on Oct 04, 2024, 08:31 PM1) you can attach player to car roof by clientside script
2) car must have a driver for correct sync the person on roof of car (vcmp has build-in attach for people who standing at car roof - for view of remote players but only if car has a driver)
3) you need to care in case shooter (player at roof) fallen down to make him stand up by script otherwise he may keep laying on car roof
but why scripting it while its already available in the offline game also i have tried many things like attaching player to vehicle but this not working