Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 275 online users. » 0 Member(s) | 274 Guest(s) Bing
|
|
|
optimize the code? |
Posted by: nbx2000 - 2022-08-07, 07:44 PM - Forum: Pawn Scripting
- No Replies
|
 |
You can improve this script or leave it like this
#include <a_samp>
#define? TIME? ? ? ? ? ? 1? //When the contest will start (Minutes)
#define? PRIZE? ? 3000 //Reward ($$$) when win in Math Contest
#define? PRIZESCORE? ? ? 5? //Reward (Score) when win in Math Contest
new answer;
new endm = 0;
new no1, no2, no3;
new typem = -1;
new timermath;
new timermath2;
new str[128];
forward Math();
forward MathEnd();
#define COLOR_YELLOW? ? 0xFFFF00FF
#define white? ? ? ? ? ? "{FFFFFF}"
#define red? ? ? ? ? ? ? "{FF002B}"
#define orange? ? ? ? ? "{F2C80C}"
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n");
print("* Math System by BuzZ *");
print("* Loaded *");
print("\n");
typem = -1;
endm = 0;
timermath = SetTimer("Math", 1000*60*TIME, true);
return 1;
}
public OnFilterScriptExit()
{
print("\n");
print("* Math System by BuzZ *");
print("* Unloaded *");
print("\n");
typem = -1;
endm = 0;
KillTimer(timermath);
return 1;
}
#endif
public Math()
{
typem = random(2);
no1 = random(600);
no2 = random(50);
no3 = random(100);
endm = 1;
switch(typem)
{
case 0:
{
? ? answer = no1 no2 no3;
format(str, sizeof(str), "MATH: "white"The first one who answers (solve) this "red"%d%d%d "orange"wins $3,000 5 score", no1, no2, no3);
SendClientMessageToAll(COLOR_YELLOW, str);
}
case 1:
{
answer = no1 - no2 - no3;
format(str, sizeof(str), "MATH: "white"The first one who answers (solve) this "red"%d-%d-%d "orange"wins $3,000 5 score", no1, no2, no3);
SendClientMessageToAll(COLOR_YELLOW, str);
}
case 2:
{
answer = no1 * no2 * no3;
format(str, sizeof(str), "MATH: "white"The first one who answers (solve) this "red"%dx%dx%d "orange"wins $3,000 5 score", no1, no2, no3);
SendClientMessageToAll(COLOR_YELLOW, str);
}
}
SendClientMessageToAll(-1, "Math will end on 30 seconds!");
timermath2 = SetTimer("MathEnd", 1000*30, false);
return 1;
}
public MathEnd()
{
switch(typem)
{
case 0:
{
format(str, sizeof(str), "MATH: "white"No one won the Math Contest the answer is '%d'", answer);
SendClientMessageToAll(COLOR_YELLOW, str);
}
case 1:
{
format(str, sizeof(str), "MATH: "white"No one won the Math Contest the answer is '%d'", answer);
SendClientMessageToAll(COLOR_YELLOW, str);
}
case 2:
{
format(str, sizeof(str), "MATH: "white"No one won the Math Contest the answer is '%d'", answer);
SendClientMessageToAll(COLOR_YELLOW, str);
}
}
endm = 0;
KillTimer(timermath2);
return 1;
}
public OnPlayerText(playerid, text[])
{
if(strval(text) == answer && endm == 1)
{
? ? format(str, sizeof(str), "MATH: %s(%d) won the Math Contest, He/She won the $%d %i score [ Answer: %d ]", GetName(playerid), playerid, PRIZE, PRIZESCORE, answer);
? ? SendClientMessageToAll(COLOR_YELLOW, str);
? ? GivePlayerMoney(playerid, PRIZE);
? ? SetPlayerScore(playerid, GetPlayerScore(playerid) PRIZESCORE);
? ? KillTimer(timermath2);
? ? endm = 0;
? ? return 0;
}
return 1;
}
You can improve this script or leave it like this? ??
|
|
|
[MySQL] Problema con registro de datos |
Posted by: GARS - 2022-07-19, 05:47 PM - Forum: Programaci?n
- Replies (2)
|
 |
Hola, tengo un problema con MySQL al registrar nuevos datos, mi servidor era SQLite y lo pase a MySQL pero al registrar un nuevo dato (registrar cuenta) en la base de datos esta no me figura/registra la el ID de forma ascendiente, me explico, en la tabla solo me registra como ID 0, as?:
![[Image: 2UtuvbC.png]](https://i.imgur.com/2UtuvbC.png)
Y cuando quiero volver a registrar otros datos(cuenta) no registra.
Ac? como est? la DB:
Code: CREATE TABLE `cuenta` (
? `ID` int(11) NOT NULL,
? `IP` varchar(16) DEFAULT NULL,
? `NAME` varchar(24) DEFAULT NULL,
? `EMAIL` varchar(32) DEFAULT NULL,
? `PASS` varchar(65) DEFAULT NULL,
? `CONNECTED` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cuenta`
? ADD PRIMARY KEY (`ID`);
Y en la gamemode as?
Code: RegisterNP(playerid)
{
new DB_Query[500];
format(DB_Query, sizeof DB_Query,
"\
INSERT INTO `CUENTA`\
(\
`IP`, `NAME`, `EMAIL`, `PASS`, `CONNECTED`\
)\
VALUES\
(\
'%q', '%q', '%q', '%q', '1'\
);\
", INFO_AC[playerid][iac_IP], INFO_AC[playerid][iac_NAME], INFO_AC[playerid][iac_EMAIL], INFO_AC[playerid][iac_PASS]);
mysql_tquery(DATABASE, DB_Query, "LoadRegisterNP", "i", playerid);
return 1;
}
|
|
|
My suggestions [Update: 2022-07-06] |
Posted by: Radical - 2022-07-02, 11:07 PM - Forum: Questions and Suggestions
- Replies (1)
|
 |
Objects & PlayerObjects:
PHP Code: SetObjectSize(objectid, Float: fX, Float: fY, Float: fZ);
SetPlayerObjectSize(objectid, Float: fX, Float: fY, Float: fZ);
GetObjectSize(objectid, &Float: fX, &Float: fY, &Float: fZ);
GetPlayerObjectSize(objectid, &Float: fX, &Float: fY, &Float: fZ);
Textdraws & PlayerTextDraws:
PHP Code: TextDrawFont(Text:text, fontface[]); //Able to use any font in TextDraw
PlayerTextDrawFont(playerid, PlayerText:text,?fontface[]);
TextDrawRotateText(Text:text, Float:rotate);
PlayerTextDrawRotateText(playerid, PlayerText:text, Float:rotate);
- Make it possible to add a new txd and player download it when connect to the server. [../omp server/models/txd]
(Like samp 0.3.DL download skin character files from server) (https://ibb.co/R2qgXLJ)
- Add color gradient textdraws.
Keys:
PHP Code: - Supporting all?Keys.
if (newkeys == 0x41) // 'A' key
File functions:
PHP Code: - Reading a directory in scriptfiles.
readdir(...);
Players:
PHP Code: ReconnectPlayer(playerid, delay=0);
TogglePlayerHUD(playerid, toggle); //Show/Hide game hud
TogglePlayerChat(playerid, toggle); //Show/Hide chats
ForcePlayerTakeScreenShot(playerid);
BurnPlayer(playerid);
TogglePlayerInvulnerable(playerid, toggle);
ReloadPlayerArmedWeapon(playerid);
RemoveWeaponFromPlayer(playerid, weaponid);
PlayerDeathListShow(playerid);
PlayerDeathListHide(playerid);
PlayerDeathListPos(playerid, Float:X, Float:Y);
SetPlayerFpsLimit(playerid, amount); // /fpslimit (30 to 90)
GetPlayerFpsLimit(playerid);
SetPlayerFontSize(playerid, size); //Chat font size /fontsize (-3 to 5)
GetPlayerFontSize(playerid);
SetPlayerPageSize(playerid, size); // /pagesize (10 to 20)
GetPlayerPageSize(playerid);
TogglePlayerHeadMove(playerid, toggle); // /headmove
TogglePlayerDebugLabels(playerid, toggle); // /dl
TogglePlayerTimestamp(playerid, toggle); // /timestamp
TogglePlayerAudioMsg(playerid, toggle); // /audiomsg
QuitPlayer(playerid); // /quit
TogglePlayerFirstPerson(playerid, toggle);
TogglePlayerIronFist(playerid, toggle);
TogglePlayerInfiniteRun(playerid, toggle);
SetPlayerMapMarkPos(playerid,?Float:x, Float:y,?Float:z); //Red mark on map
GetPlayerMapMarkPos(playerid,?&Float:x,?&Float:y,?&Float:z);
GetPlayerBreathBar(playerid, &Float:amount); //Blue bar that appears on breathing underwater (idk what to name this func)
TogglePlayerSeaWaves(playerid, toggle); //Toggle 0 = The sea does not wave and the water?are smooth
Damage:
PHP Code: OnPlayerTakeDamage(...);
OnPlayerGiveDamage(...);
- If returns 0, prevent player from health loss.
- Add new weaponid supports: WEAPON_HYDRA, WEAPON_HUNTER, WEAPON_SEASPAROW, WEAPON_BARRON, WEAPON_RUSTLER.
-?It would be nice to add all weapon-config?functions like SetWeaponDamage() to omp.
- If the player jumps from a height and dies , return last player who damage him. (On OnPlayerDeath)
Player HUD:
PHP Code: - Change game hud?position:
HUD_HealthPos(playerid, Float:X, Float:Y);
HUD_ArmourPos(playerid, Float:X, Float:Y);
HUD_BreathBarPos(playerid, Float:X, Float:Y);
HUD_WantedPos(playerid, Float:X, Float:Y);
HUD_MoneyPos(playerid, Float:X, Float:Y);
HUD_TimePos(playerid, Float:X, Float:Y);
HUD_WeaponPos(playerid, Float:X, Float:Y);
HUD_MiniMapPos(playerid,?Float:X, Float:Y);
- Show/Hide game hud:
HUD_HealthToggle(playerid, toggle);
HUD_ArmourToggle(playerid, toggle);
HUD_BreathBarToggle(playerid, toggle);
HUD_WantedToggle(playerid, toggle);
HUD_MoneyToggle(playerid, toggle);
HUD_TimeToggle(playerid, toggle);
HUD_WeaponToggle(playerid, toggle);
HUD_MiniMapToggle(playerid, toggle);
Audio Stream:
PHP Code: PlayAudioStreamForPlayerEx(playerid, url[], play_from_second = 0,?Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0); //Play audio from a specific second
PauseAudioStreamForPlayer(playerid);
ResumeAudioStreamForPlayer(playerid);
UpdateAudioStreamPosForPlayer(playerid, Float:posX = 0.0,?Float:posY?= 0.0, Float:posZ = 0.0); //If positions is 0.0?consider to player pos
GetPlayerAudioStreamUrl(playerid, &dest[], len = sizeof dest);
GetPlayerAudioStreamCurrentTime(playerid);?//Return in seconds
GetPlayerAudioStreamPos(playerid, &Float:posX, &Float:posY, &Float:posZ);
GetPlayerAudioStreamDistance(playerid, &Float:distance);
IsPlayerAudioStreamPaused(playerid);
GetAudioStreamUrlLength(url[]);?//Return in seconds
Vehicles:
PHP Code: ToggleVehicleInvulnerable(vehicleid, toggle);
SetVehicleSpeed(vehicleid, Float:speed);
Float:GetVehicleSpeed(vehicleid);
ToggleVehicleShoot(vehicleid, toggle); //Disable Hydra/Hunter/Rustler/SeaSparrow shooting
ToggleVehicleLightBars(vehicleid, toggle); //Police vehicles or Ambulance vehicles?
ToggleVehicleBlowFuelTank(vehicleid, toggle); //In gta sa offline you able to blow vehicle?by shooting at fuel tank.
FlipVehicle(vehicleid); //new Float:angle;?GetVehicleZAngle(vehicleid, angle),?SetVehicleZAngle(vehicleid, angle);
Actors:
PHP Code: SetActorArmedWeapon(actorid, weaponid);
GetActorArmedWeapon(actorid);
Validation:PHP Code: IsValidWeaponID(weaponid);
IsValidVehicleModel(modelid);
IsPositionInWater(Float: x, Float: y, Float: z);
IsVehicleOverturned(vehicleid);
IsPlayerAFK(playerid); //or IsPlayerPaused(playerid);
IsPlayerWalking(playerid); //W ALT
IsPlayerRunning(playerid); //W Space
IsPlayerStanding(playerid);
IsPlayerInvulnerable(playerid);
IsVehicleInvulnerable(vehicleid);
Strings:
PHP Code: IsNumeric(string[]);
IsDigit(string[]);
IsSpace(string[]);
IsLower(string[]);
IsUpper(string[]);
StrReplace(oldvalue[], newvalue[], &dest[], len = sizeof dest);
StrCpy(dest[], source[]);
StrCapitalize(string[], &dest[], len = sizeof dest); //First character to upper case
Server:
PHP Code: GetServerIP(); //Server?public IP address
GetServerPing();
Socket:
PHP Code: - Add TCP & UDP connections and functions.
Fixes:
PHP Code: - RemoveBuildingForPlayer(...); // It crashes game if number of removes is above 1000
- Enable tear gas coughing effect/anim. Also return amount of damage in OnPlayerTakeDamage.
- When a vehicle dies then respawned the ID was change. ID should not change.
- Head bleeding with headshot, animation deleted from sa-mp. Return it.
- OnPlayerWeaponShoot(...); //Doesn't work in lagcompmode 0
- When player press TAB key the server textdraws are hide.
Telegram: t.me/adib_yg
Discord: Adib#5980
|
|
|
So whats up now is the beta is out? |
Posted by: NoxxeR - 2022-06-06, 06:54 PM - Forum: Chat
- No Replies
|
 |
Whats up with the new Open Multiplayer client? Will it be released to the public? The server beta has been released.
Everybody will enjoy life if you guys release the Client, some of us havent played in a long time GTA SA, we need a good client soon.
|
|
|
GTA Maps in open.mp? |
Posted by: Xyranaut - 2022-06-04, 05:41 AM - Forum: Questions and Suggestions
- Replies (1)
|
 |
According to the latest SA:MP update, access to the GTA VC Map has been granted within SA:MP. I recently came across a video featuring the merging of maps from GTA 3, VC, SA, 4 and 5 into GTA SA. In the video, the creator provided links for this merged map setup.
I'm contemplating the possibility of integrating these map files seamlessly with the 'installation of open.mp'. This way, anyone using open.mp would automatically gain access to these maps, eliminating the need for manual installation by individuals.
It would be quite fascinating to envision the incorporation of all these maps, effectively utilizing them in a multiplayer environment by simply adding the map mod extension alongside open.mp.
|
|
|
|