Is it possible to... - 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: Is it possible to... (
/showthread.php?tid=423485)
Is it possible to... -
Rufio - 17.03.2013
Hey guys,
I started to script a all-in-one gamemode for SAMP. I am thinking of a system but couldnt decide if it's possible though. My system is:
For example, there is a command for DM 1 Area, whenever a guy types /dm1, he reaches to that DM area, i thought it would be a disaster to do a DM in too crowded place. Is it possible to make it like room ? To be more clear, when 10 person goes in DM1, the other guys who type /dm1 will be teleported too but their Virtual World will be changed to not see the other guys. Is it possible ?
Re: Is it possible to... -
mastermax7777 - 17.03.2013
yes
pawn Код:
new playersdm=0;
command:dm ( playerid, params[])
{
playersdm++;
if(playersdm>9) SetPlayerVirtualWorld(playerid, 69);
//do other stuff here(teleport/etc..)
return 1;
}
command: exitdm() {
playersdm--;
SetPlayerVirtualWorld(playerid, 0);
}
Re: Is it possible to... -
kamzaf - 17.03.2013
Quote:
Originally Posted by mastermax7777
yes
pawn Код:
new playersdm=0;
command:dm ( playerid, params[]) { playersdm++; if(playersdm>9) SetPlayerVirtualWorld(playerid, 69); //do other stuff here(teleport/etc..) return 1; } command: exitdm() { playersdm--; SetPlayerVirtualWorld(playerid, 0); }
|
Whats wrong with this is that what if the player doesnt type /exitdm, what if he just disconnects, the server will think that there is still a player in the DM stadium.
Also your just setting the world to 69, what if he has around 30 players online, all do /dm. the first 9 will get to world 0 but the rest 21 will go to world 69.
pawn Код:
new playersdm=0;
new DM[MAX_PLAYERS];
command:dm ( playerid, params[])
{
playersdm++;
DM[playerid] = 1;
if(playersdm>9) SetPlayerVirtualWorld(playerid, 69); DM[playerid] = 1;
//do other stuff here(teleport/etc..)
return 1;
}
command: exitdm() {
playersdm--;
DM[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
}
OnPlayerDisconnect
{
if(DM[playerid] == 1) playersdm--;
}
OnPlayerDeath
{
if(DM[playerid] == 1) playersdm--;
}
Re: Is it possible to... -
Rufio - 17.03.2013
No problem there, i have typed inDM[playerid] = 0; to onplayerconnect
thanks for helping me i will try to use it ^^
Re: Is it possible to... -
mastermax7777 - 18.03.2013
lol that was just a template.. im not going to script a whole perfect gm just for your approval