Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,508
» Latest member: Quall1955
» Forum threads: 2,414
» Forum posts: 12,367

Full Statistics

Online Users
There are currently 622 online users.
» 0 Member(s) | 620 Guest(s)
Bing, Google

Latest Threads
[HELP]How to Retrieve and...
Forum: Pawn Scripting
Last Post: Quall1955
9 hours ago
» Replies: 2
» Views: 2,797
Adding new vehicles and s...
Forum: Programming
Last Post: __.A.__
Yesterday, 02:52 AM
» Replies: 2
» Views: 126
How to create a custom SA...
Forum: Tech
Last Post: HELLHOUND
Yesterday, 12:12 AM
» Replies: 1
» Views: 768
Silly little render a did...
Forum: Art
Last Post: HELLHOUND
2025-09-14, 09:00 PM
» Replies: 0
» Views: 59
HWID BAN
Forum: Questions and Suggestions
Last Post: HELLHOUND
2025-09-14, 08:44 PM
» Replies: 1
» Views: 887
Manual sorting of servers...
Forum: Questions and Suggestions
Last Post: HELLHOUND
2025-09-14, 08:35 PM
» Replies: 1
» Views: 698
San Fierro Cops And Robbe...
Forum: Advertisements
Last Post: Dr0pp
2025-09-13, 08:33 PM
» Replies: 0
» Views: 96
Zona América del Sur Free...
Forum: Advertisements
Last Post: kevinberriosflores
2025-09-12, 02:16 PM
» Replies: 1
» Views: 141
Busco copia de gamemode S...
Forum: Spanish/Espa?ol
Last Post: briancristaldo2021
2025-09-11, 11:14 AM
» Replies: 0
» Views: 138
[Tutorial] Registrando o ...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-09-09, 08:36 PM
» Replies: 0
» Views: 258

 
  Loop
Posted by: JaKe Elite - 2021-10-20, 08:34 AM - Forum: Pawn Scripting - No Replies

I am having troubles with looping. I have been experimenting with textdraws and how to make them work with the Inventory System.?



However I notice something that the loop skips a textdraw or an index part of loop if the condition is -1.



For example, I have the following in my inventory



Code:
0. Marijuana

1. Cocaine

2. Heroin

3. Stereoids

4. Drinks

5. Foods

6. Keys

7. Katana



If I remove cocaine from the list, the loop will skip and display the preview models to these order.



Code:
0. Marijuana

NULL (-1) = Nothing is displayed

2. Heroin

3. Stereoids

4. Drinks

5. Foods

6.?Keys

7. Katana



I? have tried messing around with the code but it still skips a part of the loop (the last one)



Code:
0. Marijuana

1. Heroin

2. Stereoids

3. Drinks

4. Foods

5.?Keys

6. Katana

NULL (-1)



What I would like to do with the loop is that it shouldn't skip.



Screenshot:

[Image: KgyRiy0.png]

What the Inventory Normally looks like



[Image: Hgzo75p.png]

What the Inventory looks like when an item is removed, notice the last part doesn't get created instead of moving to the next one to fill it up.



Code:

PHP Code:
static stock ShowInventoryTextDrawToPlayer(playeriditems[], size sizeof(items))

{

new 
Float:123.5Float:150.0page[64];

format(pagesizeof(page), "Inventory - Page 1/%d", (size MAX_ITEMS_VISIBLE)  1);



// background 

for(new 0<= 2iTextDrawShowForPlayer(playeridinv_interactive_box[i]);

// buttons (use, drop, give)

for(new 0<= 2iTextDrawShowForPlayer(playeridinv_interactive_button[i]);

// previous & next buttons 

TextDrawShowForPlayer(playeridinv_interactive_nextprev[0]);

TextDrawShowForPlayer(playeridinv_interactive_nextprev[1]);



// create player textdraw inventories



// header 

player_inv_header[playerid] = CreatePlayerTextDraw(playerid321.000000128.000000page);

PlayerTextDrawFont(playeridplayer_inv_header[playerid], 2);

PlayerTextDrawLetterSize(playeridplayer_inv_header[playerid], 0.2541661.350000);

PlayerTextDrawTextSize(playeridplayer_inv_header[playerid], 400.000000272.500000);

PlayerTextDrawSetOutline(playeridplayer_inv_header[playerid], 1);

PlayerTextDrawSetShadow(playeridplayer_inv_header[playerid], 0);

PlayerTextDrawAlignment(playeridplayer_inv_header[playerid], 2);

PlayerTextDrawColor(playeridplayer_inv_header[playerid], -1);

PlayerTextDrawBackgroundColor(playeridplayer_inv_header[playerid], 255);

PlayerTextDrawBoxColor(playeridplayer_inv_header[playerid], 1296911806);

PlayerTextDrawUseBox(playeridplayer_inv_header[playerid], 1);

PlayerTextDrawSetProportional(playeridplayer_inv_header[playerid], 1);

PlayerTextDrawSetSelectable(playeridplayer_inv_header[playerid], 0);



// inventory items

for (new 0idx 0!= MAX_INVENTORY_ITEMS)

{

if(
>= size)

{

player_TDInvData[playerid][player_TDInvModel][i] = -1;

}

else 

{

? ? if (
items[i] == -1)

{

continue;

? ? ? ? ? ? ? ? 
//player_TDInvData[playerid][player_TDInvModel][i] = -1;

? ? ? ? ? ? ? ? //player_TDInvData[playerid][player_TDInvQuantity][i] = 0;

? ? ? }

? else

? {

player_TDInvData[playerid][player_TDInvModel][i] = items[i];



? ? ? ? ? ? 
//player_TDInvData[playerid][player_TDInvQuantity][i] = amounts[i];

}

if (
MAX_ITEMS_VISIBLE)

{

if (
idx && (idx MAX_ITEMS_PER_COL) == 0)

{

189.0;

74.0;

}

else 

{

66.0;

}

idx;



? ? ? ? if (
MAX_ITEMS_VISIBLE && items[i] != -1)

{

? ? 
player_inv_model[playerid][i] = CreatePlayerTextDraw(playeridxy"_");



PlayerTextDrawFont(playeridplayer_inv_model[playerid][i], 5);

PlayerTextDrawLetterSize(playeridplayer_inv_model[playerid][i], 0.6000002.000000);

PlayerTextDrawTextSize(playeridplayer_inv_model[playerid][i], 62.00000069.000000);

PlayerTextDrawSetOutline(playeridplayer_inv_model[playerid][i], 1);

PlayerTextDrawSetShadow(playeridplayer_inv_model[playerid][i], 0);

PlayerTextDrawAlignment(playeridplayer_inv_model[playerid][i], 1);

PlayerTextDrawColor(playeridplayer_inv_model[playerid][i], -1);

PlayerTextDrawBackgroundColor(playeridplayer_inv_model[playerid][i], 255);

PlayerTextDrawBoxColor(playeridplayer_inv_model[playerid][i], 50);

PlayerTextDrawUseBox(playeridplayer_inv_model[playerid][i], 0);

PlayerTextDrawSetProportional(playeridplayer_inv_model[playerid][i], 1);

PlayerTextDrawSetSelectable(playeridplayer_inv_model[playerid][i], 1);

PlayerTextDrawSetPreviewModel(playeridplayer_inv_model[playerid][i], items[i]);

PlayerTextDrawSetPreviewRot(playeridplayer_inv_model[playerid][i], 0.0000000.0000000.0000001.000000);

PlayerTextDrawSetPreviewVehCol(playeridplayer_inv_model[playerid][i], 11);

}

}

}

}



player_TDInvData[playerid][player_TDSelectedItem] = -1// Reset selected item.

player_TDInvData[playerid][player_TDInvPage] = 1;

player_TDInvData[playerid][player_TDInvTotalPage] = (size MAX_ITEMS_VISIBLE)  1;



// show it 

PlayerTextDrawShow(playeridplayer_inv_header[playerid]); 



for(new 
0MAX_ITEMS_VISIBLEiPlayerTextDrawShow(playeridplayer_inv_model[playerid][i]);



SelectTextDraw(playerid0x33AA33FF);

return 
1;

}



stock ShowPlayerInventory(playerid)

{

if((
<= playerid MAX_PLAYERS) || IsPlayerConnected(playerid)) // prevent ID spoof.

{

new 
items[44] = {-1, ...}, count;



for (new 
044)

{

if (
InventoryData[playerid][i][invExists]) {

items[i] = InventoryData[playerid][i][invModel];

count ;

}

}



if(
count >= 1)

ShowInventoryTextDrawToPlayer(playeriditemssizeof(items));

else 

SendClientMessage(playerid, -1"You do not have anything in your inventory.");

}

return 
1;

}



CMD:demo2(playeridparams[])

{

Inventory_Remove(playerid"Cocaine");

return 
1;

}



CMD:demo(playeridparams[])

{

Inventory_Add(playerid"Marijuana"1578);

Inventory_Add(playerid"Cocaine"1575);

Inventory_Add(playerid"Heroin"1577);

Inventory_Add(playerid"Steroids"1241);

Inventory_Add(playerid"Marijuana Seeds"1578);

Inventory_Add(playerid"Cocaine Seeds"1575);

Inventory_Add(playerid"Heroin Opium Seeds"1577);

Inventory_Add(playerid"Golf Club"333);

Inventory_Add(playerid"Knife"335);

Inventory_Add(playerid"Shovel"337);

Inventory_Add(playerid"Katana"339);

Inventory_Add(playerid"Colt 45"346);

Inventory_Add(playerid"Desert Eagle"348);

Inventory_Add(playerid"Micro SMG"352);

Inventory_Add(playerid"Tec-9"372);

Inventory_Add(playerid"MP5"353);

Inventory_Add(playerid"Shotgun"349);

Inventory_Add(playerid"AK-47"355);

Inventory_Add(playerid"Rifle"357);

Inventory_Add(playerid"Sniper"358);

Inventory_Add(playerid"Magazine"2039);

Inventory_Add(playerid"Cooked Burger"2703);

Inventory_Add(playerid"Cooked Pizza"2702);

Inventory_Add(playerid"Driving License"1581);

//Inventory_Add(playerid, "Weapon License", 1581);

Inventory_Add(playerid"Cellphone"330);

Inventory_Add(playerid"GPS System"18875);

Inventory_Add(playerid"Spray Can"365);

Inventory_Add(playerid"Water Bottle"2958);

Inventory_Add(playerid"Soda"1543);

? ? 
Inventory_Add(playerid"Fuel Can"1650);

Inventory_Add(playerid"Crowbar"18634);

Inventory_Add(playerid"Boombox"2226);

Inventory_Add(playerid"Mask"19036);

Inventory_Add(playerid"First Aid"1580);

Inventory_Add(playerid"Repair Kit"920);

Inventory_Add(playerid"NOS Canister"1010);

Inventory_Add(playerid"Frozen Pizza"2814);

Inventory_Add(playerid"Frozen Burger"2768);

Inventory_Add(playerid"Ammo Cartridge"2358);

Inventory_Add(playerid"Armored Vest"19142);

Inventory_Add(playerid"Empty Bottle"1484);

Inventory_Add(playerid"Cardboard"928);

Inventory_Add(playerid"Chicken"2663);

Inventory_Add(playerid"Portable Radio"18868);

return 
1;



Brick Battlefields - TDM (Team Deathmatch)
Posted by: [SF]kAn3 - 2021-10-18, 07:10 AM - Forum: Gamemodes - Replies (2)

Hello.

This is a TDM gamemode, so basically a PVP gamemode where players join a team and fight against other teams, and that's one of my projects I am NOT working on anymore.

So I am sharing the source code, do whatever you like with it!



Since I am not working on it anymore, I won't update the code, so please don't ask me anything about that!



Here I will add some short description:



There are several teams in war with each other. Teams have to conquer zones scattered all over the map, some of them are bonus zones that give different bonuses to the team that's controlling it.

Players have to choose classes, each class has its own abilities.

There's a bayonet system, some weapons have on them a knife, and you can stab foes with it for an insta-kill.



And there's more, you can find that trying the gamemode.



I don't have the plugins needed to run the gamemode, sorry about that!



Here I will post some videos:



https://www.youtube.com/watch?v=0c5HPd4-_Sg



https://www.youtube.com/watch?v=IMvi8aVbB6A



https://www.youtube.com/watch?v=2u8W1PWPCCQ



Download .pwn file


Brick Discordia - PvP & PvE (Player Vs Player, Player Vs Environment)
Posted by: [SF]kAn3 - 2021-10-18, 06:58 AM - Forum: Gamemodes - No Replies

Hello.



As the subject says, this is a gamemode I was working on during my free time.

I've decided to share it with anyone who's interested in working on it, I really liked how it was going to be, maybe some of you will give it a real life!



This gamemode is focused on PVP and PVE, taking place in a fictionary world, where players need to strive to survive, building their camp, fighting NPCs and other players, join/fight clans, build your player and levelup, scavenge the world for resources, food, water, weapons and so on.



I am NOT going to update this, things may change, but as for now I won't touch the code anymore ever, so don't ask me anything and feel free to do what you like with it!

Also, you will have to find all the needed plugins, I don't have them anymore!



Here I will post some videos:



https://www.youtube.com/watch?v=cV80d_jEk1M



https://www.youtube.com/watch?v=Sf_QxC3In9A



Download .pwn file


  Qu? fue pe oe
Posted by: drauxen - 2021-10-16, 12:13 AM - Forum: Spanish/Espa?ol - Replies (1)

Buenas. Alguien me pone al d?a con lo que pas? con este proyecto? No entro hace a?os


  A simple mission system from singleplayer
Posted by: MirsoN - 2021-10-12, 11:09 PM - Forum: Videos and Screenshots - No Replies

Take a look at a simple mission system like the one from singleplayer, the video quality is bad sorry, leave your comment?



[Video: https://youtu.be/g1bFNcvO1GE]


  UpdateVehicleDamageStatus
Posted by: JR_Junior - 2021-10-10, 01:38 AM - Forum: Pawn Scripting - Replies (1)

Hello, I am creating an armor system for the vehicle.

I am using a timer to repair the vehicle all the time and have noticed that 4 door vehicles sometimes the rear doors are not fixed until the vehicle is damaged again.



I did a test with a friend and the damaged door only appears to me.

Was it a bug or a sync error?





This is how I see it:

[Image: Screenshot-27.png]



This is how my friend sees it:

[Image: Screenshot-28.png]


  GTA SA remastered
Posted by: NoxxeR - 2021-10-09, 08:12 AM - Forum: Chat - Replies (6)

Anybody seen the videos of GTA SA Remastered? Rockstar games is gonna release a new GTA SA version, with new engine and stuff.



https://www.youtube.com/watch?v=v9FWmcY6xsg



Do you guys know if it will be playable online? Will someone make a modification for it? Would been awesome, GTA SA Remastered will be fun ;)


Brick Simple AFK system
Posted by: Flofey - 2021-10-08, 06:56 PM - Forum: Filterscripts - Replies (2)

AFK Filterscript




Simple AFK filterscript system includes 2 commands, and yes right it would be nice if it was made only with one command

but it's made for beginner so they can understand the code.



What with this script?


This script is made of two commands

  • /afk - gets you away from keyboard by freezing the player, so he cannot move or get damaged while he's away also there'll be 3D text label above the player's head labeling (AFK).

  • /back - gets the player back with his movements and everything as normal.





Recommended files

ZCMD - Github

Downloads



AFK.pwn - Download





credits to Zeex for the amazing ZCMD.

Waiting for your responds fellas.


  Loop skipping (Creating only odd numbers)
Posted by: Cherry. - 2021-10-06, 02:41 AM - Forum: Support - Replies (3)

Hey.



I have a command of creating houses.

The loop is creating houses just like 1,3,5,7,9,11..etc.



I tried to investigate the problem in the loop and I can't see anything wrong.

Somebody?knows? Here's the code..







Code:
COMMAND:housecreate(playerid, params[])

{

new houseid, price, Float:X, Float:Y, Float:Z, UID, text[128];

if(sscanf(params,"ii",houseid, price)) return usage(playerid, "USAGE: /HouseCreate [Class] [Value]");

if(houseid < 1 || houseid > 4) return error(playerid, "Invalid house ID.");

new found = 0;

for(new i = 1; i < MAX_HOUSES; i)

{

if(HouseInfo[i][hID] == 0 && found == 0)

{

? ? found;

? ? UID = i;

format(text, sizeof(text), "House id is %d", UID);

SendClientMessage(playerid, -1, text);

}

}

new count = 0;

for(new i = 0; i < sizeof(HouseCoordinates); i)

{

? ? if(count == 0)

? ? {

? ? ? ? if(HouseCoordinates[i][Class] == houseid)

? ? ? ? {

? ? ? ? count;

HouseInfo[UID][hXi] = HouseCoordinates[i][mbX];

HouseInfo[UID][hYi] = HouseCoordinates[i][mbY];

HouseInfo[UID][hZi] = HouseCoordinates[i][mbZ];

HouseInfo[UID][hIntIn] = HouseCoordinates[i][HouseInt];

}

}

}

HouseInfo[UID][hID] = UID;

HouseInfo[UID][hValue] = price;

HouseInfo[UID][hClass] = houseid;

HouseInfo[UID][hIntOut] = GetPlayerInterior(playerid);

HouseInfo[UID][hVwOut] = GetPlayerVirtualWorld(playerid);

HouseInfo[UID][hVwIn] = MAX_INTS  UID;

GetPlayerPos(playerid, X, Y, Z);

HouseInfo[UID][hXo] = X;

HouseInfo[UID][hYo] = Y;

HouseInfo[UID][hZo] = Z;

new query[516], owner[25];

format(owner, sizeof(owner), "None");

mysql_format(handlesql, query, sizeof(query),"INSERT INTO `houses`(`ID`, `Xo`, `Yo`, `Zo`, `Xi`, `Yi`, `Zi`, `IntOut`, `IntIn`, `VwOut`, `Owner`, `Value`) VALUES (%d, %f, %f, %f, %f, %f, %f, %d, %d, %d, '%e', %d)",

UID, X, Y, Z, HouseInfo[UID][hXi], HouseInfo[UID][hYi], HouseInfo[UID][hZi], HouseInfo[UID][hIntOut], HouseInfo[UID][hIntIn], HouseInfo[UID][hVwOut],

owner, price);

mysql_pquery(handlesql, query);

HouseInfo[UID][hIcon] = CreateDynamicCP(HouseInfo[UID][hXo], HouseInfo[UID][hYo], HouseInfo[UID][hZo], 1.5, HouseInfo[UID][hVwOut], -1, -1, 20.0);

HouseInfo[UID][hIconi] = CreateDynamicCP(HouseInfo[UID][hXi], HouseInfo[UID][hYi], HouseInfo[UID][hZi], 1.5, HouseInfo[UID][hVwIn], -1, -1, 20.0);

UpdateHouseText(UID);

Iter_Add(HouseIterator, UID);

return 1;

}


  Write plugins
Posted by: Paulthas01 - 2021-10-02, 01:28 PM - Forum: Support - No Replies

Existe um post local falando sobre como escrever plug-ins para o samp?