Exercice en Pawn - Avancй
#15

terminй, tiens:
PHP Code:
#include <zcmd>
#include <dini>
#include <sscanf2>
#define MAX_OBJECTS 500
new totalobjets 0;
enum ObInfo
{
    
Model,
    
Float:Pos[3];
}
new 
ObjetInfo[MAX_OBJECTS][ObInfo];

public 
OnGameModeInit()
{
    
LoadObjects();
    return 
1;
}

stock LoadObjects()
{
    new 
string[128];
     for(new 
1&ltMAX_OBJECTSi++)
    {
        
format(string,sizeof(string),"objets/%d.ini",i);
        if(
dini_Exists(string))
        {
        
ObjetInfo[i][Pos][0] = dini_Float(string"X");
        
ObjetInfo[i][Pos][1] = dini_Float(string"Y");
        
ObjetInfo[i][Pos][2] = dini_Float(string"Z");
        
ObjetInfo[i][Model] = dini_Int(string"Model");
        
CreateObject(ObjetInfo[i][Model], ObjetInfo[i][Pos][0], ObjetInfo[i][Pos][1], ObjetInfo[i][Pos][2], 000100);
        
totalobjets += 1;
        }
    }
    return 
1;
}

stock SaveObject(objet)
{
    new 
string[128];
    
format(string,sizeof(string),"objets/%d.ini",objet);
    if(
dini_Exists(string))
    {
    
dini_IntSet(string"Model"ObjetInfo[objet][Model]);
    
dini_FloatSet(string"X"ObjetInfo[objet][Pos][0]); 
    
dini_FloatSet(string"Y"ObjetInfo[objet][Pos][1]);
    
dini_FloatSet(string"Z"ObjetInfo[objet][Pos][2]);
    }
    else {
    
dini_Create(string);
    
dini_IntSet(string"Model"ObjetInfo[objet][Model]);
    
dini_FloatSet(string"X"ObjetInfo[objet][Pos][0]); 
    
dini_FloatSet(string"X"ObjetInfo[objet][Pos][1]);
    
dini_FloatSet(string"X"ObjetInfo[objet][Pos][2]);    
    }
    return 
1;
}

CMD:objet(playeridparams[])
{
    new 
idcdt[5], Float:PosJ[3];
    if(
sscanf(params"is[5]"idcdt)) return SendClientMessage(playerid, -1"Commande: /objet ID [SAVE(OUI/NON)]");
    if(
strcmp(cdt"OUI"true) == 0)
    {
    
totalobjets += 1;
    new 
objet totalobjets;
    
GetPlayerPos(playeridPosJ[0], PosJ[1], PosJ[2]);
    for(new 
0&lt3i++) ObjetInfo[objet][Pos][i] = PosJ[i];
    
ObjetInfo[objet][Model] = id;
    
CreateObject(idPosJ[0], PosJ[1], PosJ[2], 000100);
    
SetPlayerPos(playeridPosJ[0]+2PosJ[1]+2PosJ[2]);
    
SaveObject(objet);
    }
    else if(
strcmp(cdt"NON"true) == 0)
    {
    
GetPlayerPos(playeridPosJ[0], PosJ[1], PosJ[2]);
    
CreateObject(modelidPosJ[0], PosJ[1], PosJ[2], 000100);
    
SetPlayerPos(playeridPosJ[0]+2PosJ[1]+2PosJ[2]);
    }
    else return 
SendClientMessage(playerid, -1"SAVE doit кtre OUI OU NON !!!!!!! PFFFF");
    return 
1;

Reply


Messages In This Thread
Exercice en Pawn - Avancй - by Dutheil - 16.04.2015, 20:40
Re : Exercice en Pawn - Avancй - by Z3N0N - 16.04.2015, 21:03
Re : Exercice en Pawn - Avancй - by Ivory - 17.04.2015, 15:01
Re : Exercice en Pawn - Avancй - by Dutheil - 17.04.2015, 15:16
Re : Exercice en Pawn - Avancй - by Ivory - 17.04.2015, 16:06
Re : Exercice en Pawn - Avancй - by Chipardeur - 17.04.2015, 16:17
Re : Exercice en Pawn - Avancй - by Ivory - 17.04.2015, 16:19
Re : Exercice en Pawn - Avancй - by Dutheil - 17.04.2015, 16:31
Re : Exercice en Pawn - Avancй - by Ivory - 17.04.2015, 18:52
Re : Exercice en Pawn - Avancй - by TheWWorld - 19.04.2015, 11:18
Re : Exercice en Pawn - Avancй - by Vukilore - 19.04.2015, 11:31
Re : Exercice en Pawn - Avancй - by Sunaxx - 22.04.2015, 18:50
Re : Exercice en Pawn - Avancй - by MrAlexisX2 - 24.04.2015, 12:19
Re : Exercice en Pawn - Avancй - by TheWWorld - 27.04.2015, 17:44
Re : Exercice en Pawn - Avancй - by nicolaskettler - 03.05.2015, 22:45
Re : Exercice en Pawn - Avancй - by nicolaskettler - 03.05.2015, 22:47
Re : Exercice en Pawn - Avancй - by S4t3K - 04.05.2015, 09:31
Re: Exercice en Pawn - Avancй - by Noliax8 - 04.05.2015, 09:36
Re : Exercice en Pawn - Avancй - by S4t3K - 04.05.2015, 09:40
Re : Exercice en Pawn - Avancй - by Chipardeur - 04.05.2015, 23:38
Re : Exercice en Pawn - Avancй - by S4t3K - 05.05.2015, 12:42
Re : Exercice en Pawn - Avancй - by Ivory - 05.05.2015, 14:46
Re : Exercice en Pawn - Avancй - by S4t3K - 05.05.2015, 15:08
Re : Exercice en Pawn - Avancй - by Ivory - 05.05.2015, 17:09
Re : Exercice en Pawn - Avancй - by Chipardeur - 06.05.2015, 02:12
Re: Exercice en Pawn - Avancй - by TheArrow - 06.05.2015, 07:34
Re : Exercice en Pawn - Avancй - by Ivory - 06.05.2015, 08:42
Re : Exercice en Pawn - Avancй - by S4t3K - 06.05.2015, 14:18
Re : Exercice en Pawn - Avancй - by Ivory - 06.05.2015, 15:35
Re : Exercice en Pawn - Avancй - by Dutheil - 20.05.2015, 19:25
Re : Exercice en Pawn - Avancй - by S4t3K - 06.11.2015, 10:29
Re : Exercice en Pawn - Avancй - by S4t3K - 08.11.2015, 15:36

Forum Jump:


Users browsing this thread: 1 Guest(s)