SA-MP Forums Archive
Dynamic System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dynamic System (/showthread.php?tid=635775)



Dynamic System - Lajko1 - 13.06.2017

Hey guys I'm struggling for few days now and can't find a proper way to create own dynamic system (just practicing a bit and trying to make poker script)

Yeh I searched around, I checked the code(s) the one I downloaded is confusing me a bit and couldn't understand it fully, so what I'm currently trying to do is.. that each poker table I create will have their's own ID, and couldn't manage to create command that will teleport me to table id I want.

here is the code, and I want you to check for me if I'm on right path for creating a dynamic way without bugs that might accure in future with my way of doing it:

Код:
PlacePokerTable(tableid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, virtualworld, interior)
{
	pkrTable[tableid][PokerX] = x;
	pkrTable[tableid][PokerY] = y;
	pkrTable[tableid][PokerZ] = z;
	pkrTable[tableid][PokerRX] = rx;
	pkrTable[tableid][PokerRY] = ry;
	pkrTable[tableid][PokerRZ] = rz;

	// Create Table
	pkrTable[tableid][PokerObject] = CreateObject(POKER_TABLE_OBJECT, x, y, z, rx, ry, rz, POKER_DRAWDISTANCE );

	// Create 3D Text Label
	new szString[64];
	format(szString, sizeof(szString), "Poker Table %d", tableid);
	pkrTable[tableid][Table3D] = Create3DTextLabel(szString, -1, x, y, z+1.3, POKER_LABELDISTANCE, virtualworld, 0);

	//SavePokerTables();

	return tableid;
}

CMD:createpoker(playerid,params[])
{
	new msg[128];
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid,x,y,z);
	new interior = GetPlayerInterior(playerid);
	new vw = GetPlayerVirtualWorld(playerid);
	TotalTables++;
	
	new tableid = PlacePokerTable(TotalTables, x, y, z+0.5, 0.0, 0.0, 0.0, vw, interior);
	
	SetPVarFloat(playerid, "PkrX", pkrTable[tableid][PokerX]);
	SetPVarFloat(playerid, "PkrY", pkrTable[tableid][PokerY]);
	SetPVarFloat(playerid, "PkrZ", pkrTable[tableid][PokerZ]);
	SetPVarFloat(playerid, "PkrRX", pkrTable[tableid][PokerRX]);
	SetPVarFloat(playerid, "PkrRY", pkrTable[tableid][PokerRY]);
	SetPVarFloat(playerid, "PkrRZ", pkrTable[tableid][PokerRZ]);
	
	format(msg,sizeof(msg),"Poker Table %d created",TotalTables);
	SendClientMessage(playerid,-1,msg);
 	return 1;
}
So what I'm trying to do here is everytime I use /createpoker the "TotalTables++;" count will raise and that's what I'm trying to use for "defining" table id.
Can you check and tell if I'm doing anything wrong with that way or if there are examples to show it's more than appriciated. Is there a better way for doing it? If you need more code like enum etc let me know.
Thanks for answer in advance


Re: Dynamic System - NewFreeroamStunt - 13.06.2017

you want create the private poker table for players? and players can /goto to the poker and can buy the private poker?