Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================================//
- // [BoostSystem By DH240473] //
- // Thanks To Zeex For ZCMD Include //
- //============================================================================//
- #include <a_samp>
- #include <zcmd>
- //Colors
- #define Yellow 0xFFDD00AA
- //New Stuff
- new Float:Boost[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && !IsPlayerNPC(i))//Detect A Connected And Non Npc Player ! Means False
- {
- Boost[i] = 1.5;//Set The Boost Amount
- }
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Boost[playerid] = 1.5;//Set The Boost Amount
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if (newkeys & KEY_FIRE)
- {
- new Float:x, Float:y, Float:z;
- GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
- if (floatabs(x) < 3 && floatabs(y) < 3 && floatabs(z) < 3)
- {
- SetVehicleVelocity(GetPlayerVehicleID(playerid), x * Boost[playerid], y * Boost[playerid], z * Boost[playerid]);
- }
- return 1;
- }
- }
- return 1;
- }
- CMD:ssb(playerid, params[])
- {
- new strBoostMultiplier[256],idx = 0;
- new strTempString[256];
- strBoostMultiplier = strtok(params, idx);
- if (!strlen(strBoostMultiplier))
- {
- SendClientMessage(playerid, Yellow, "++ Usage: /ssb [Amount]");
- SendClientMessage(playerid, Yellow, "+ Allows You To Set The Boost Amount That Is Applied When You Press KEY FIRE");
- SendClientMessage(playerid, Yellow, "+ Accepted Boost Amount That Are Values Between 1.0 And 3.0");
- format(strTempString,sizeof(strTempString), "+ Your current Boost Amount is: %0.2f", Boost[playerid]);
- SendClientMessage(playerid, Yellow, strTempString);
- return 1;
- }
- if (!IsNumeric2(strBoostMultiplier))
- {
- SendClientMessage(playerid, Yellow, "++ Usage: /ssb [Amount]");
- SendClientMessage(playerid, Yellow, "+ Allows You To Set The Boost Amount That Is Applied When You Press KEY FIRE");
- SendClientMessage(playerid, Yellow, "+ Accepted Boost Amount That Are Values Between 1.0 And 3.0");
- format(strTempString,sizeof(strTempString), "+ Your current Boost Amount is: %0.2f", Boost[playerid]);
- SendClientMessage(playerid, Yellow, strTempString);
- return 1;
- }
- new Float:BoostMultiplier = floatstr(strBoostMultiplier);
- if (BoostMultiplier < 1.0 || BoostMultiplier > 3.0)
- {
- SendClientMessage(playerid, Yellow, "+ Sorry, you must enter a Boost Amount Between 1.0 and 3.0");
- return 1;
- }
- Boost[playerid] = BoostMultiplier;
- format(strTempString,sizeof(strTempString), "+You Set Your Boost Amount To %0.2f", Boost[playerid]);
- SendClientMessage(playerid, Yellow, strTempString);
- return 1;
- }
- stock strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- IsNumeric2(const string[])
- {
- new length=strlen(string);
- if (length==0) return false;
- for (new i = 0; i < length; i++)
- {
- if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.')
- || (string[i]=='-' && i!=0)
- || (string[i]=='+' && i!=0)
- ) return false;
- }
- if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement