Small question.
#1

Hello guys.
I'm making a detain system, I succeded with that, but the only problem I've got is making different detained players seats.

I wan't to make the maximum of detained players 3, and each one in different seat.

I've got this as a command:

PHP код:
dcmd_detenir(playerid,params[])
{
    new 
string[128];
    new 
ID;
    if(
sscanf(params"u"ID))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Utilisation: /detenir (Nom de joueur/ID)");
        return 
1;
    }
    if(
IsSpawned[playerid] != 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Vous devez spawn pour pouvoir utiliser cette commande.");
        return 
1;
    }
        
format(string,sizeof(string),"[RADIO DE POLICE] L'officier de police %s(%d) a dйtenu %s(%d) dans son vйhicule.",PlayerName(playerid),playerid,PlayerName(ID),ID);
        
SendClientMessageToAll(COLOR_DODGERBLUE,string);
        
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Detenir_]]");
        
format(string,sizeof(string),"L'officier de police %s(%d) vous a dйtenu.",PlayerName(playerid),playerid);
        
SendClientMessage(ID,COLOR_DODGERBLUE,string);
        
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Detenir_]]");
        
format(string,sizeof(string),"Vous avez dйtenu %s(%d) dans votre vehicule.",PlayerName(ID),ID);
        
SendClientMessage(playerid,COLOR_DODGERBLUE,string);
        
GameTextForPlayer(ID,"~R~Vous avez ete detenu par un policier . Aie vous кtes foutue :/.",5000,4);
        
PutPlayerInVehicle(ID,LastVehicle[playerid],I wan't a random seat here);
    return 1;

Thanks in advance.
Reply
#2

PHP код:
dcmd_detenir(playerid,params[]) 

    new 
string[128]; 
    new 
ID
    if(
sscanf(params"u"ID)) 
    { 
        
SendClientMessage(playerid,COLOR_ERROR,"Utilisation: /detenir (Nom de joueur/ID)"); 
        return 
1
    } 
    if(
IsSpawned[playerid] != 1
    { 
        
SendClientMessage(playerid,COLOR_ERROR,"Vous devez spawn pour pouvoir utiliser cette commande."); 
        return 
1
    } 
        
format(string,sizeof(string),"[RADIO DE POLICE] L'officier de police %s(%d) a dйtenu %s(%d) dans son vйhicule.",PlayerName(playerid),playerid,PlayerName(ID),ID); 
        
SendClientMessageToAll(COLOR_DODGERBLUE,string); 
        
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Detenir_]]"); 
        
format(string,sizeof(string),"L'officier de police %s(%d) vous a dйtenu.",PlayerName(playerid),playerid); 
        
SendClientMessage(ID,COLOR_DODGERBLUE,string); 
        
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Detenir_]]"); 
        
format(string,sizeof(string),"Vous avez dйtenu %s(%d) dans votre vehicule.",PlayerName(ID),ID); 
        
SendClientMessage(playerid,COLOR_DODGERBLUE,string); 
        
GameTextForPlayer(ID,"~R~Vous avez ete detenu par un policier . Aie vous кtes foutue :/.",5000,4); 
        new 
Seats PutPlayerInEmptyVehicleSeat(LastVehicle[playerid],ID);
        if(
Seats != INVALID_PLAYER_ID)
        {
         
SendClientMessage(playerid,COLOR_ERROR,"No free seats");
        }
        
    return 
1
}  
forward PutPlayerInEmptyVehicleSeat(vehicleid,playerid);
public 
PutPlayerInEmptyVehicleSeat(vehicleid,playerid)
{
    new 
bool:Seat[4],seat;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerInVehicle(i,vehicleid))
        {
            
seat GetPlayerVehicleSeat(i);
            if(!(
<= seat sizeof(Seat))) seat sizeof(Seat)-1;
            
Seat[seat] = true;
        }
    }
    for(new 
seatID sizeof(Seat)-1seatID > -1seatID--)
        if(!
Seat[seatID])
        {
            
seat INVALID_PLAYER_ID;
            
PutPlayerInVehicle(playerid,vehicleid,seatID);
            break;
        }
    return 
seat;

Reply
#3

It doesn't function well: if(Seats != INVALID_PLAYER_ID)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)