Help: Delay Spawn Player
#1

Hi guys, i need code for spawn delay 10 sec of players , Someone can help me??
Reply
#2

i this is what you're looking for. if not, give me more details

PHP код:
#include <a_samp>
new spawndelay[MAX_PLAYERS];
forward OneSecondUpdate();
public 
OnPlayerConnect(playerid){
    
spawndelay[playerid] = 0;
    return 
1;
}
public 
OnPlayerSpawn(playerid){
    if(
spawndelay[playerid] > 0){
        
SendClientMessage(playerid0xFF0000FF"You spawned too fast!");
        
Kick(playerid);    
    }
    
spawndelay[playerid] = 10;
    return 
1;
}
public 
OnGameModeInit(){
    
SetTimer("OneSecondUpdate"10001);
    return 
1;
}
public 
OneSecondUpdate(){
    for(new 
iMAX_PLAYERSi++){
        
spawndelay[i] -= 1;     
    }

Reply
#3

Quote:
Originally Posted by Vennox
Посмотреть сообщение
i this is what you're looking for. if not, give me more details

PHP код:
#include <a_samp>
new spawndelay[MAX_PLAYERS];
forward OneSecondUpdate();
public 
OnPlayerConnect(playerid){
    
spawndelay[playerid] = 0;
    return 
1;
}
public 
OnPlayerSpawn(playerid){
    if(
spawndelay[playerid] > 0){
        
SendClientMessage(playerid0xFF0000FF"You spawned too fast!");
        
Kick(playerid);    
    }
    
spawndelay[playerid] = 10;
    return 
1;
}
public 
OnGameModeInit(){
    
SetTimer("OneSecondUpdate"10001);
    return 
1;
}
public 
OneSecondUpdate(){
    for(new 
iMAX_PLAYERSi++){
        
spawndelay[i] -= 1;     
    }

Код:
CMD:class(playerid,params[])
{


    CLS[playerid]= SetTimerEx("ClassSelection", 10000, false, "i", playerid);
    SendClientMessage(playerid, 0xFF0000FF,"Change class in 10 sec");
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" , "Select", "");
I am doing a Dialog_list and i want after choose player that takes 10 seconds in spawn, can u help me??
Reply
#4

make that code on your dialog response like Vennox gave you
dialogid == 1
Reply
#5

Quote:
Originally Posted by CrystalGamer
Посмотреть сообщение
make that code on your dialog response like Vennox gave you
dialogid == 1
I am trying but I have failed, Someone can help me with code??


PHP код:
CMD:class(playerid,params[])
{
    
CLS[playerid]= SetTimerEx("ClassSelection"10000false"i"playerid);
    
SendClientMessage(playerid0xFF0000FF,"Change class in 10 sec");
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select"""); 
Reply
#6

PHP код:
forward ClassSelection(playerid);
public 
ClassSelection(playerid){
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select""");
}
CMD:class(playerid,params[]) 

    
CLS[playerid]= SetTimerEx("ClassSelection"10000false"i"playerid); 
    
SendClientMessage(playerid0xFF0000FF,"Your class will be changed in 10 seconds, please wait."); 
    return 
1;

Reply
#7

Quote:
Originally Posted by Vennox
Посмотреть сообщение
PHP код:
forward ClassSelection(playerid);
public 
ClassSelection(playerid){
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select""");
}
CMD:class(playerid,params[]) 

    
CLS[playerid]= SetTimerEx("ClassSelection"10000false"i"playerid); 
    
SendClientMessage(playerid0xFF0000FF,"Your class will be changed in 10 seconds, please wait."); 
    return 
1;

Vennox, i want show Dialog_List first and later choose player to spawn at 10 sec, Can u help me??
Reply
#8

PHP код:
forward ClassSelection(playerid, class);
public 
ClassSelection(playerid, class){
    
//here you change the player's class: 0 = Negros, 1 = Civiles, 2 = Mafia, etc.
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]){
    if(
dialogid == 1){
        
SendClientMessage(playerid, -1"Your class will be changed in 10 seconds.");
        
SetTimerEx("ClassSelection"10000false"ii"playeridlistitem);
    }
}
CMD:class(playerid,params[]) 

    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select"""); 
    return 
1;

I can't understand what you want
Reply
#9

Quote:
PHP код:
forward ClassSelection(playerid, class); 
public 
ClassSelection(playerid, class){ 
    
//here you change the player's class: 0 = Negros, 1 = Civiles, 2 = Mafia, etc. 

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]){ 
    if(
dialogid == 1){ 
        
SendClientMessage(playerid, -1"Your class will be changed in 10 seconds."); 
        
SetTimerEx("ClassSelection"10000false"ii"playeridlistitem); 
    } 

CMD:class(playerid,params[])  
{  
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select""");  
    return 
1

I can't understand what you want

Very thx, solve it!!, I have a problem now ... I have 2 dialogues, and every time I use / class the dialog 0 is used, why does this happen??
PHP код:
new SKIN_MODELS[] = {
    
21,
    
2,
    
124,
    
122,
    
285,
    
108,
    
248,
    
295,
    
159,
    
50,
    
296,
    
287
};
new 
SKIN_NAMES[][] = {
    
"__Negros",
    
"_Civiles",
    
"___Mafia",
    
"____Nang",
    
"____Swat",
    
"_Surenos",
    
"___Biker",
    
"____Rich",
    
"_Farmers",
    
"Mechanic",
    
"____Pimp",
    
"Soldados"
};
public 
OnPlayerRequestClass(playeridclassid)
{
    
PlayAudioStreamForPlayer(playerid"http://www.debbiewiseman.co.uk/samples/warriors.mp3");
    
SetSpawnInfo(playerid000030000000);
    
TogglePlayerSpectating(playeridtrue);
    
SetTimerEx("login_dialog"00"i"playerid);
const 
MAX_SKINS 312;
    static 
string[MAX_SKINS 16];
    if (
string[0] == EOS) {
        for (new 
iMAX_SKINSi++) {
            
format(stringsizeof string"%s%i\tID: %i\n"stringii);
        }
    }
    
    return 
ShowPreviewModelDialog(playerid0"Selecciуn de Equipo"SKIN_MODELS,SKIN_NAMES "Select""Cancel");
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
if(
dialogid == 0)
{
        switch(
listitem)
{
case 
0: {
  switch(
random(6)) // Negros
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
}
}
}
return 
1;
}
CMD:class(playerid,params[])
{
    
GetPlayerHealth(playeridhealth);
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select""");
    
SendClientMessage(playerid, -1"Your class will be changed in 10 seconds.");
    
SetTimerEx("ClassSelection"10000false"i"playerid);
 
}
public 
ClassSelection(playeriddialogidresponselistiteminputtext[])
{
switch(
listitem)
{
case 
0: {
  switch(
random(6)) // Negros
  
{
        case 
0:
        {
         
SetPlayerSkin(playerid19);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2659.7424,260.6835,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
2:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2695.9822,262.4749,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
3:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2694.5286,276.3913,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
4:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid,-2659.1301,275.6968,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
5:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2665.8315,237.6608,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
  }

Reply
#10

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Very thx, solve it!!, I have a problem now ... I have 2 dialogues, and every time I use / class the dialog 0 is used, why does this happen??
PHP код:
new SKIN_MODELS[] = {
    
21,
    
2,
    
124,
    
122,
    
285,
    
108,
    
248,
    
295,
    
159,
    
50,
    
296,
    
287
};
new 
SKIN_NAMES[][] = {
    
"__Negros",
    
"_Civiles",
    
"___Mafia",
    
"____Nang",
    
"____Swat",
    
"_Surenos",
    
"___Biker",
    
"____Rich",
    
"_Farmers",
    
"Mechanic",
    
"____Pimp",
    
"Soldados"
};
public 
OnPlayerRequestClass(playeridclassid)
{
    
PlayAudioStreamForPlayer(playerid"http://www.debbiewiseman.co.uk/samples/warriors.mp3");
    
SetSpawnInfo(playerid000030000000);
    
TogglePlayerSpectating(playeridtrue);
    
SetTimerEx("login_dialog"00"i"playerid);
const 
MAX_SKINS 312;
    static 
string[MAX_SKINS 16];
    if (
string[0] == EOS) {
        for (new 
iMAX_SKINSi++) {
            
format(stringsizeof string"%s%i\tID: %i\n"stringii);
        }
    }
    
    return 
ShowPreviewModelDialog(playerid0"Selecciуn de Equipo"SKIN_MODELS,SKIN_NAMES "Select""Cancel");
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
if(
dialogid == 0)
{
        switch(
listitem)
{
case 
0: {
  switch(
random(6)) // Negros
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid21);
         
SetSpawnInfo(playerid,0,21,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
}
}
}
return 
1;
}
CMD:class(playerid,params[])
{
    
GetPlayerHealth(playeridhealth);
    
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nSurenos\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" "Select""");
    
SendClientMessage(playerid, -1"Your class will be changed in 10 seconds.");
    
SetTimerEx("ClassSelection"10000false"i"playerid);
 
}
public 
ClassSelection(playeriddialogidresponselistiteminputtext[])
{
switch(
listitem)
{
case 
0: {
  switch(
random(6)) // Negros
  
{
        case 
0:
        {
         
SetPlayerSkin(playerid19);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2659.7424,260.6835,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
2:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2695.9822,262.4749,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
3:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2694.5286,276.3913,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
4:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid,-2659.1301,275.6968,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
5:
        {
         
SetPlayerSkin(playerid19);
         
SetPlayerPos(playerid, -2665.8315,237.6608,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
  }

I solve it, very thx Vennox!!!! i removed TogglePlayerSpectating(playerid, true); and now is OK

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
//TogglePlayerSpectating(playerid, true);  
TogglePlayerSpectating(playeridfalse);
return 
1;
 } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)