Dynamic system
#1

Hello guys i am on my way on making an nise dialog-based dynamic dealership.

Right now im making a basic command [ / buyinfernus ] to see if it is working.
This is the CMD :
PHP код:
  // comanda buy infernus//
        
if(strcmp(cmd"/buyinfernus"true) == 0)
    {
        if(
PlayerInfo[playerid][pLevel] >= )
         {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /buyinfernus [color1] [color2] ");
                return 
1;
            }
        
//    new car;
        //    car = strval(tmp);
        //    if(car < 411 || car > 411) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}*Aceasta este comanda de a cumpara infernus !"); return 1; }
        //    tmp = strtok(cmdtext, idx);
        //    if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE:{C0C0C0} /buyinfernus"); return 1; }
            
new color1;
            
color1 strval(tmp);
            if(
color1 || color1 126) { SendClientMessage(playeridCOLOR_WHITE"{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
            new 
color2;
            
color2 strval(tmp);
            if(
color2 || color2 126) { SendClientMessage(playeridCOLOR_WHITE"{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
            new 
Float:X,Float:Y,Float:ZGetPlayerPos(playeridX,Y,Z);
            new 
thiscar CreateVehicle(411,X,Y,Z,1,color1,color2,99999999);
          
//  new value = strval(tmp);
            
CarInfo[thiscar][cModel] = 411CarInfo[thiscar][cColorOne] = color1CarInfo[thiscar][cColorTwo] = color2;
               
CarInfo[thiscar][cLocationx] = XCarInfo[thiscar][cLocationy] = YCarInfo[thiscar][cLocationz] = ZCarInfo[thiscar][cAngle] = 1;
            
CarInfo[thiscar][paintjob] = -1LoadComponents(thiscar); PutPlayerInVehicle(playerid,thiscar,0);
            
CarInfo[thiscar][cOwned] = 1;
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
strmid(CarInfo[thiscar][cOwner], sendername0strlen(sendername), 999);
            
GivePlayerMoney(playerid,-150000);
            
//Delete3DTextLabel(TextUpCar[idcar]);
              
OnCarUpdate(); SavePlayerData(playerid);
            
PlayerPlaySound(playerid10520.00.00.0);
            
GameTextForPlayer(playerid"~w~Felicitari~n~ai platit 150k pentru infernus !"50003);
            
TogglePlayerControllable(playerid1);
          return 
1;
          }
    } 
The problem is that,i want tha car owner to be the one that types /buyinfernus....the problem is that the car is created,but the owner its not set...everyone can drive it..

Please guys,i need tips on how to make it work.
Reply
#2

You need to lock the vehicle for everyone,
Then unlock it for the player who did the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)