SA-MP Forums Archive
Spawn problem - 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: Spawn problem (/showthread.php?tid=414378)



Spawn problem - gurmani11 - 09.02.2013

.....................


Re: Spawn problem - Da_Noob - 09.02.2013

That's maybe because you used

pawn Код:
inDM[playerid] == 1
twice.

You should make it so, if the player is in DMZone 2, InDM is also set to 2 instead of 1. That should work.
So, this would be your new code:

pawn Код:
if(InDM[playerid] == 1) {
new rand = random(sizeof(DM1));
SetPlayerPos(playerid, DM1[rand][0], DM1[rand][1], DM1[rand][2]);
SetPlayerHealth(playerid, 100.0);
SetPlayerVirtualWorld(playerid, 10);
GivePlayerWeapon(playerid, WEAPON_UZI, 4096);
GivePlayerWeapon(playerid, WEAPON_SAWEDOFF, 1024);


return 1;
} if(InDM[playerid] == 2) {
new rand = random(sizeof(DM2));
SetPlayerPos(playerid, DM2[rand][0], DM2[rand][1], DM2[rand][2]); // Rnadom DM Spawns
SetPlayerVirtualWorld(playerid, 9);
SetPlayerHealth(playerid, 100.0);
GivePlayerWeapon(playerid, 25, 48;
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 512);
GivePlayerWeapon(playerid, WEAPON_SNIPER, 12;


return 1;
}
I just set the last InDM[playerid] to 2.


Re: Spawn problem - gurmani11 - 09.02.2013

.....................


Re: Spawn problem - RajatPawar - 09.02.2013

Use [pawn] tags.
pawn Код:
if (strcmp("/Leave", cmdtext, true, 10) == 0)
{
if(InDM[playerid] == 1 || InDM[playerid] == 2)
{

new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s (ID:%d) has Left the DM /leave.", PlayerName, playerid);
SendClientMessageToAll(COLOR_GREY, string);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
SetPlayerPos(playerid, player_x, player_y, player_z);
InDM[playerid] = 0;
}
else SendClientMessage(playerid, 0xFFFFFFFF, "** You are not in Death Match to use this command.");
return 1;
}



Re: Spawn problem - Da_Noob - 09.02.2013

pawn Код:
if (strcmp("/Leave", cmdtext, true, 10) == 0)
{
if(InDM[playerid] == 1)
{

new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s (ID:%d) has Left the DM /leave.", PlayerName, playerid);
SendClientMessageToAll(COLOR_GREY, string);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
SetPlayerPos(playerid, player_x, player_y, player_z);
InDM[playerid] = 0;
}
else if(InDM[playerid] == 2)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s (ID:%d) has Left the DM /leave.", PlayerName, playerid);
SendClientMessageToAll(COLOR_GREY, string);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
SetPlayerPos(playerid, player_x, player_y, player_z);
InDM[playerid] = 0;
}
else SendClientMessage(playerid, 0xFFFFFFFF, "** You are not in Death Match to use this command.");
return 1;
}
This should work. In your previous code you only checked if the player was in DM zone 1, but not in DM zone 2. So you just have to make a simple check, so the server checks if the player is in DM zone 1 OR DM Zone 2.

EDIT: Just noticed the guy above me was faster, and his code is better. Use his!


Re: Spawn problem - gurmani11 - 09.02.2013

.....................