ShAgGyKing 0 Odesláno: 3. Duben, 2021 Share Odesláno: 3. Duben, 2021 Zdravím, nemáte niekto script na tempomat? Skúšal som vlastný cez SetVehicleVelocity, ale nefunguje. Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 3. Duben, 2021 Share Odesláno: 3. Duben, 2021 Dobre by bolo že ked si skúšal tak treba dať aj kod Link to comment Share on other sites More sharing options...
0 ShAgGyKing 0 Odesláno: 4. Duben, 2021 Author Share Odesláno: 4. Duben, 2021 (upraveno) Spoiler new tempomat[MAX_PLAYERS]; //Keď sa pripojí, odpojí alebo odíde z vozidla, tak sa nastaví na -1 Float:GetVehicleSpeed(vehicleid) { new Float:x, Float:y, Float:z; if(GetVehicleVelocity(vehicleid, x, y, z)) { return floatsqroot((x * x) + (y * y) + (z * z)) * 180; } return 0.0; } CMD:tempomat (playerid, params[]) { new tkm; if(sscanf(params, "i", tkm) && tempomat[playerid] == -1) { return SCM(playerid, red, "Použitie: /tempomat [Rýchlosť]"); } if(sscanf(params, "i", tkm) && tempomat[playerid] != -1) { tempomat[playerid] = -1; return SCM(playerid, green, "Tempomat vypnutý!"); } if(IsPlayerInAnyVehicle(playerid) == 0) return SCM(playerid, red, "Nie ste vo vozidle!"); tempomat[playerid] = -1; new vid; vid = GetPlayerVehicleID(playerid); if(tkm < GetVehicleSpeed(vid)) { new Float:x, Float:y, Float:z; GetVehicleVelocity(vid, Float:x, Float:y, Float:z); if(Float:x == 0 || Float:y == 0 || Float:z == 0) { if(Float:x == 0) { SetVehicleVelocity(vid, Float:x, Float:y - 0.00005, Float:z + 0.00005); } if(Float:y == 0) { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y, Float:z + 0.00005); } if(Float:z == 0) { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y - 0.00005, Float:z + 0.00005); } } else { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y - 0.00005, Float:z + 0.00005); } } if(tkm > GetVehicleSpeed(vid)) { new Float:x, Float:y, Float:z; GetVehicleVelocity(vid, Float:x, Float:y, Float:z); if(Float:x == 0 || Float:y == 0 || Float:z == 0) { if(Float:x == 0) { SetVehicleVelocity(vid, Float:x, Float:y + 0.00005, Float:z + 0.00005); } if(Float:y == 0) { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y, Float:z + 0.00005); } if(Float:z == 0) { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y + 0.00005, Float:z + 0.00005); } } else { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y + 0.00005, Float:z + 0.00005); } } tempomat[playerid] = tkm; return 1; } public OnPlayerUpdate(playerid) { if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vid; vid = GetPlayerVehicleID(playerid); if(tempomat[playerid] < GetVehicleSpeed(vid) && tempomat[playerid] != -1) { new Float:x, Float:y, Float:z; GetVehicleVelocity(vid, Float:x, Float:y, Float:z); if(Float:x == 0 || Float:y == 0 || Float:z == 0) { if(Float:x == 0) { SetVehicleVelocity(vid, Float:x, Float:y - 0.00005, Float:z + 0.00005); } if(Float:y == 0) { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y, Float:z + 0.00005); } if(Float:z == 0) { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y - 0.00005, Float:z + 0.00005); } } else { SetVehicleVelocity(vid, Float:x - 0.00005, Float:y - 0.00005, Float:z + 0.00005); } } if(tempomat[playerid] > GetVehicleSpeed(vid) && tempomat[playerid] != -1) { new Float:psx, Float:psy, Float:psz; GetVehiclePos(vid, Float:psx, Float:psy, Float:psz); new Float:x, Float:y, Float:z; GetVehicleVelocity(vid, Float:x, Float:y, Float:z); if(Float:x == 0 || Float:y == 0 || Float:z == 0) { if(Float:x == 0) { SetVehicleVelocity(vid, Float:x, Float:y + 0.00005, Float:z + 0.00005); } if(Float:y == 0) { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y, Float:z + 0.00005); } if(Float:z == 0) { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y + 0.00005, Float:z + 0.00005); } } else { SetVehicleVelocity(vid, Float:x + 0.00005, Float:y + 0.00005, Float:z + 0.00005); } } } return 1; } Pri compile to nehádže žiadne errory ani warningy, ale keď zadám príkaz, tak auto začne spomaľovať, a po chvíli sa úplne zastaví. Edited 4. Duben, 2021 by ShAgGyKing 1 Link to comment Share on other sites More sharing options...
0 Globální moderátor Hip 191 Odesláno: 4. Duben, 2021 Globální moderátor Share Odesláno: 4. Duben, 2021 před 21hodinami, Mivčo said: Dobre by bolo že ked si skúšal tak treba dať aj kod Kód, to je https://cs.wikipedia.org/wiki/Zdrojový_kód nastuduj si tu wiki ať víš co to je a pak ho prosím konečně přidej. Link to comment Share on other sites More sharing options...
0 ShAgGyKing 0 Odesláno: 5. Duben, 2021 Author Share Odesláno: 5. Duben, 2021 Už som to vyriešil :D Link to comment Share on other sites More sharing options...
0 bigMike20 2 Odesláno: 6. Duben, 2021 Share Odesláno: 6. Duben, 2021 Jak Link to comment Share on other sites More sharing options...
Dotaz
ShAgGyKing 0
Zdravím, nemáte niekto script na tempomat? Skúšal som vlastný cez SetVehicleVelocity, ale nefunguje.
Link to comment
Share on other sites
5 odpovědí na tuto otázku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now