Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 7,607
» Latest member: gmpat7970
» Forum threads: 2,334
» Forum posts: 12,262
Full Statistics
|
Online Users |
There are currently 595 online users. » 1 Member(s) | 591 Guest(s) Google, Bing, DuckDuckGo, NmE
|
Latest Threads |
Original Godfather
Forum: Pawn Scripting
Last Post: NmE
Yesterday, 08:35 PM
» Replies: 0
» Views: 21
|
Tierra Robada Roleplay [E...
Forum: Advertisements
Last Post: Vicee
Yesterday, 04:00 PM
» Replies: 0
» Views: 25
|
City of Grand RP
Forum: Advertisements
Last Post: KaidoSancho
Yesterday, 03:49 PM
» Replies: 0
» Views: 16
|
RevolutionX DM/Stunt/Race...
Forum: Advertisements
Last Post: DerekZ905
Yesterday, 09:02 AM
» Replies: 0
» Views: 41
|
Problem with MAP. Please ...
Forum: Pawn Scripting
Last Post: hoshimitsu
2025-10-12, 06:39 AM
» Replies: 0
» Views: 38
|
I get since compiler and ...
Forum: Pawn Scripting
Last Post: pauli
2025-10-11, 03:29 PM
» Replies: 0
» Views: 44
|
SA-MP: Map Construction
Forum: General Discussions
Last Post: king599
2025-10-11, 12:56 AM
» Replies: 1
» Views: 3,841
|
AntyCheat System [SA-MP/O...
Forum: Filterscripts
Last Post: ingxavier05
2025-10-10, 06:53 PM
» Replies: 8
» Views: 13,407
|
PROJECT: LAS VENTURAS
Forum: Advertisements
Last Post: Avine96
2025-10-09, 11:16 PM
» Replies: 0
» Views: 63
|
[HELP] Back to Pawn Scrip...
Forum: Pawn Scripting
Last Post: king599
2025-10-09, 04:59 AM
» Replies: 1
» Views: 73
|
|
|
Colour Embedding Issue |
Posted by: Torque - 2021-01-21, 11:14 PM - Forum: Support
- Replies (3)
|
 |
It seems that there's a bug with colour embedding, whether it be dialogs or chat text.
It seems the colour is "leaking" into the next word in which a colour has already been set for.
|
|
|
How to optimize this code |
Posted by: RhaegarX - 2021-01-21, 08:30 PM - Forum: Pawn Scripting
- Replies (5)
|
 |
I have this enum that stores the information of organizations stored with mysql.
PHP Code: enum oInfo { oID, oName[50], oMoney, oMaterials, oMaconha, oCrack, oCocaina, oOrgVip, oOrgVipTime, Float:oPosX, Float:oPosY, Float:oPosZ, Float:oPosA, oInterior, oWorld, oSkinLider, oSkinLiderF, oSkinMember, oSkinMember2, oSkinMember3, oSkinMember4, oSkinMember5, oSkinMemberF, oSalaryLider, oSalaryMember, oSalaryMember2, oSalaryMember3, oSalaryMember4, oSalaryMember5, oLider[MAX_PLAYER_NAME], oSubLider[MAX_PLAYER_NAME], oMember1[MAX_PLAYER_NAME], oMember2[MAX_PLAYER_NAME], oMember3[MAX_PLAYER_NAME], oMember4[MAX_PLAYER_NAME], oMember5[MAX_PLAYER_NAME], oMember6[MAX_PLAYER_NAME], oMember7[MAX_PLAYER_NAME], oMember8[MAX_PLAYER_NAME], oMember9[MAX_PLAYER_NAME], oMember10[MAX_PLAYER_NAME], oMember11[MAX_PLAYER_NAME], oMember12[MAX_PLAYER_NAME], oMember13[MAX_PLAYER_NAME], oMember14[MAX_PLAYER_NAME], oMember15[MAX_PLAYER_NAME], oMember16[MAX_PLAYER_NAME], oMember17[MAX_PLAYER_NAME], oMember18[MAX_PLAYER_NAME], oMember19[MAX_PLAYER_NAME], oMember20[MAX_PLAYER_NAME], oMember21[MAX_PLAYER_NAME], oMember22[MAX_PLAYER_NAME], oMember23[MAX_PLAYER_NAME], oMember24[MAX_PLAYER_NAME], oMember25[MAX_PLAYER_NAME], oMember26[MAX_PLAYER_NAME], oMember27[MAX_PLAYER_NAME], oMember28[MAX_PLAYER_NAME], oMember29[MAX_PLAYER_NAME], oMember30[MAX_PLAYER_NAME]
}; new OrgInfo[MAX_ORGS][oInfo];
There is a situation, in which I will display all the members of the organization, however as we can see there are more than 30 members and the current way in which I do this is to write the code for each member.
PHP Code: format(string, sizeof(string), "Member 1: %s\n", OrgInfo[org][oMember1]); strcat(membersList, string);
format(string, sizeof(string), "Member 2: %s\n", OrgInfo[org][oMember2]); strcat(membersList, string);
.... 30 Code Very Long
ShowPlayerDialog(playerid, DIALOG_ORG_BACK, DIALOG_STYLE_TABLIST_HEADERS, "Membros da Organiza??o", membersList, "Voltar", "Fechar");
I would like to know if there is any way, to access the variable of each member without having to be one by one. Perhaps with the use of some repetition loop? It's possible?
|
|
|
Best practice with timers |
Posted by: RhaegarX - 2021-01-21, 02:16 AM - Forum: Pawn Scripting
- Replies (3)
|
 |
Hello guys!? I would like to ask a question about the use of timers.? Suppose I have several systems that do checks from time to time, the best way would be to create a single timer that does all the checks or create multiple timers to check each thing?? Which way would be the most optimized and least burdensome on the server?
Code 1:
PHP Code: SetTimer("ExecuteAll", 1000, false);
public ExecuteAll() { // Verification 1 // Verification 2 // Verification 3 ... }
Code 2:
PHP Code: SetTimer("Execute1", 1000, false); SetTimer("Execute2", 1000, false); SetTimer("Execute3", 1000, false);
public Execute1() { // Verification 1 } public Execute2() { // Verification 2 } public Execute3() { // Verification 3 }
|
|
|
Ternary Operator Basics |
Posted by: RhaegarX - 2021-01-20, 07:29 PM - Forum: Tutorials
- Replies (4)
|
 |
"Sorry for the bad English, I'm using the translator to do this tutorial."
- What is a ternary operator?
In various situations in programming we need to deal with various scenarios, through conditional structures, such as if, else and switch. However, in some situations we deal with wave situations there are only 2 possible returns.
For example, let's imagine a hypothetical situation, in which if the player is an administrator he wins $ 1500, otherwise he will win $ 500.
We can do this logic using the if and else operator:
PHP Code: if (PlayerData[playerid][pAdmin] > 0)
{? ? ? ? ?
? ? GivePlayerMoney(playerid, 1500);
}
else
{
? ? GivePlayerMoney(playerid, 500);
}
Now notice that we are making a relatively long structure for a simple action, with only two possibilities. Is there no other way to write this code in a simpler way? Yes, there is, and that is what the ternary operator is for:
PHP Code: GivePlayerMoney(playerid, (PlayerData[playerid][pAdmin] > 0 ? 1500 : 500));
Now we did the same action with just one line of code, however let's understand a little bit about how to build a ternary operator.
- How to build a ternary operator?
Building a ternary operator is simple, its own structure is self-explanatory.
PHP Code: (condition ? value if true : value if false)
To better understand, we can see that the '?' acts as an if and the ':' acts as the else.
- In what situations will I use the ternary operator?
This is a relative question, it depends a lot on the type of logic that you will build for your system, but as stated in the first question we will use the ternary operator for situations in which there are only 2 possibilities of return. Remembering that the ternary operator is not limited to returning only number values, but can also return strings and other options.
Example of a string with a ternary operator:
PHP Code: SendClientMessage(playerid, -1, (playerData[playerid][pAdmin] > 0 ? "True" : "false"));
- Problems with ternary operator
The main problem with the ternary operator is its structure, which because it is very compact, its structure can be difficult to read by programmers who are not used to it.
- End
This is my first personal authoring tutorial, i hope you like it and criticism will always be welcome!
|
|
|
TSConnector and some other fce |
Posted by: Ardenis - 2021-01-20, 06:46 PM - Forum: Pawn Scripting
- Replies (1)
|
 |
Hey there
the TS_PokeClient function does not work correctly. When someone joins the game, they poke them ?
let's look at the code
Code: public TSC_OnClientConnect (clientid, nickname [])
{
new str[50];
format(str, sizeof(str), "> %s (%d) has join to our ts3 server", nickname, clientid);
SendClientMessageToAll(-1, str);
TSC_SendClientMessage(clientid, "Yup, here it works");
TSC_PokeClient(clientid, "Welcome"); // But not here, it not poke him but idk why
return 1;
}
http://prntscr.com/xb40i1
https://github.com/maddinat0r/samp-tsconnector/releases
|
|
|
Divide by zero |
Posted by: Zow - 2021-01-20, 06:02 PM - Forum: Pawn Scripting
- Replies (1)
|
 |
Code: ExpProgress(playerid)
{
? ? new Float:exp = playerData[playerid][pExp]*100/PlayerRequiredExp(playerid);
? ? return exp;
}
PlayerRequiredExp(playerid)
{
? ? new requiredexp = playerData[playerid][pLevel] * 2000;
return requiredexp;
}
pExp are always start from 0 when you're level up
So crashdetect always give me this?Run time error 11: "Divide by zero"
I need some idea how to get pass this one
I just want to popup exp to % but I need pExp to start by 0 when level up
Is that possible?
|
|
|
|