07.12.2009, 01:40
Of course it's possible, and it requires more math and less scripting skill.
Tested and works to 80% satisfaction
*issues: May cause lag at higher player bases and higher pings. Occasionally it doesn't work and player will have uncapped speeds until completely stopped (as far as I can tell)
I think maybe my speed calculation is incorrect, but it seems fairly accurate.
pawn Код:
new pSpeedLimit[MAX_PLAYERS]={-1,...};
new Float:gTempFloat[4];
public OnPlayerConnect(playerid)
{
pSpeedLimit[playerid]=-1;
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext[1],"setlimit",true,8))
{
pSpeedLimit[playerid]=strval(cmdtext[10]);
return SendClientMessage(playerid,0x99CC9900," Speed Limit Set");
}
}
public OnPlayerUpdate(playerid)
{
if(pSpeedLimit[playerid]>-1)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid),gFloatTemp[0],gFloatTemp[1],gFloatTemp[2]);
gFloatTemp[3]=(floatsqroot(gFloatTemp[0]*gFloatTemp[0]+gFloatTemp[1]*gFloatTemp[1]+gFloatTemp[2]*gFloatTemp[2])*100)/pSpeedLimit[playerid];
if(gFloatTemp[3]>1)SetVehicleVelocity(GetPlayerVehicleID(playerid),gFloatTemp[0]/gFloatTemp[3],gFloatTemp[1]/gFloatTemp[3],gFloatTemp[2]/gFloatTemp[3]);
}
return 1;
}
*issues: May cause lag at higher player bases and higher pings. Occasionally it doesn't work and player will have uncapped speeds until completely stopped (as far as I can tell)
I think maybe my speed calculation is incorrect, but it seems fairly accurate.