Cuff systems? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cuff systems? (
/showthread.php?tid=187503)
Cuff systems? -
Deal-or-die - 03.11.2010
is i possible to be able to make a cuffing system that enables players to run but not sprint nor drive? as that is more Realistic then breaking handcuffs.
Re: Cuff systems? -
Backwardsman97 - 03.11.2010
It's possible. You could check if their velocity on-foot was greater than a normal running speed and slow them down. And for the other, you could just make it to where they couldn't get in vehicles.
Re: Cuff systems? -
Deal-or-die - 03.11.2010
Quote:
Originally Posted by Backwardsman97
It's possible. You could check if their velocity on-foot was greater than a normal running speed and slow them down. And for the other, you could just make it to where they couldn't get in vehicles.
|
This would be rather hard to script though right...?
if so...
Sigh, now i gotta look for a fricken Beut scripter
Re: Cuff systems? -
Grim_ - 03.11.2010
Just make a quick script to print your velocity while running (not sprinting) and check what it is. You can then build off of there.
pawn Код:
// This will print the velocity of the player
// Load this as a filterscript, go in-game and type /print
// Then run (without sprinting) to check the velocity
// Exit the game
// Look at the console for the results
// NOTE: You may want to run for a while so you can see the running results more than others
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/print", true) == 0)
{
SetTimerEx("Timer", 1000, 1, "i", playerid);
return 1;
}
return 0;
}
forward Timer(playerid);
public Timer(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerVelocity(playerid, X, Y, Z);
print("X: %0.2f | Y: %0.2f | Z: %0.2f", X, Y, Z);
return 1;
}
After you retrieve the normal X Y and Z velocity of normal running, you can check if the player is cuffed and running at a higher velocity than that and reduce their velocity with SetPlayerVelocity.
Re: Cuff systems? -
Deal-or-die - 03.11.2010
Quote:
Originally Posted by Grim_
Just make a quick script to print your velocity while running (not sprinting) and check what it is. You can then build off of there.
After you retrieve the normal X Y and Z velocity of normal running, you can check if the player is cuffed and running at a higher velocity than that and reduce their velocity with SetPlayerVelocity.
|
Hmmm, when i compile i get 4 warnings
(11) : warning 213: tag mismatch
(24) : warning 202: number of arguments does not match definition
(24) : warning 202: number of arguments does not match definition
(24) : warning 202: number of arguments does not match definition
it doesn't work assuming cos of those errors.
Re: Cuff systems? -
Grim_ - 03.11.2010
pawn Код:
// Line 11
if(!strcmp(cmdtext, "/print", true))
// Line 24
printf("X: %0.2f | Y: %0.2f | Z: %0.2f", X, Y, Z);
Re: Cuff systems? -
Deal-or-die - 03.11.2010
Quote:
Originally Posted by Grim_
pawn Код:
// Line 11 if(!strcmp(cmdtext, "/print", true))
// Line 24 printf("X: %0.2f | Y: %0.2f | Z: %0.2f", X, Y, Z);
|
ok, thanks that worked,
i run at an average of -0.11 Y
so how would i make the hand cuff scrip work by slowing the speed down?
Re: Cuff systems? -
HireMe - 03.11.2010
to disable players with cuffs to get in a car you can use something like this.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (Cuffed[playerid] == 1)
{
new string[128];
new Float:x, Float:y, Float:z;
format(string, sizeof(string), "you cant enter a vehicle with your cuffs on!");
SendClientMessage(playerid, 0xFFFFFFFF, string);
GetPlayerPos(playerid,x,y,z);
return SetPlayerPos(playerid,x,y,z+3);
}
return 1;
}