cmd to edit dynamic vehicle positions
#1

So baiscly i based the cmd on dynamic object edit but it doesent work ;/

PHP Code:
CMD:editveh(playeridparams[])
{
    new 
string[128], idx;
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
mDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on Mapper Duty.");
    if(
sscanf(params"i"idx)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /editveh [vehicleid]");
5457    if(!VehInfo[idx][vModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid vehicle id.");
    
vEdit[playerid] = 1;
    
vEditID[playerid] = idx;
    
GetDynamicVehiclePos(VehInfo[idx][obj], vPos[playerid][0], vPos[playerid][1], vPos[playerid][2]);
    
GetDynamicVehicleRot(VehInfo[idx][obj], vRot[playerid][0], vRot[playerid][1], vRot[playerid][2]);
    
EditDynamicVehicle(playeridVehInfo[idx][veh]);
    
format(stringsizeof(string), " You are now editing vehicle ID %d's position."idx);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
format(stringsizeof(string), "MapperWarn: %s is editting vehicle ID %d's position.)"RPN(playerid), idx);
    
SendMapperMessage(COLOR_GREEN1string);
    return 
1;

This is how the car creation cmd looks like
PHP Code:
CMD:createveh(playeridparams[])
{
    new 
string[128], object;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pMapper] < 3) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
mDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on Mapper Duty.");
    if(
sscanf(params"i"object)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /createveh [modelid]");
    for(new 
idx=1idx<MAX_vvvehidx++)
    {
        if(!
vvvehInfo[idx][vvvModel])
        {
            
GetPlayerPos(playeridvvvehInfo[idx][vvvX], vvvehInfo[idx][vvvY], vvvehInfo[idx][vvvZ]);
              
vvvehInfo[idx][vvvModel] = object;
            
vvvehInfo[idx][vvvX] = vvvehInfo[idx][vvvX] + 2;
            
vvvehInfo[idx][vvvY] = vvvehInfo[idx][vvvY] + 2;
            
vvvehInfo[idx][vvvZ] = vvvehInfo[idx][vvvZ] + 2;
            
vvvehInfo[idx][vvvAn] =0;
            
vvvehInfo[idx][vvvC1] =0;
            
vvvehInfo[idx][vvvC2] =0;
            
// Creating
            
vvvehInfo[idx][vvveh] = CreateVehicle(vvvehInfo[idx][vvvModel], vvvehInfo[idx][vvvX], vvvehInfo[idx][vvvY], vvvehInfo[idx][vvvZ], vvvehInfo[idx][vvvAn], vvvehInfo[idx][vvvC1], vvvehInfo[idx][vvvC2], 1200);
            
// Text
            
format(stringsizeof(string), "MapperWarn: %s has spawned dynamic vehicle %d. (Model: %d)"RPN(playerid), idxobject);
            
SendClientMessage(playeridCOLOR_WHITE"You may save a new position with /saveveh");
            
SendMapperMessage(COLOR_GREEN1string);
            
idx MAX_vvveh;
        }
    }
    return 
1;

This is how object editing looks like:
PHP Code:
CMD:editobj(playeridparams[])
{
    new 
string[128], idx;
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
mDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on Mapper Duty.");
    if(
sscanf(params"i"idx)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /editobj [objectid]");
    if(!
ObjInfo[idx][oModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid object id.");
    
oEdit[playerid] = 1;
    
oEditID[playerid] = idx;
    
GetDynamicObjectPos(ObjInfo[idx][obj], oPos[playerid][0], oPos[playerid][1], oPos[playerid][2]);
    
GetDynamicObjectRot(ObjInfo[idx][obj], oRot[playerid][0], oRot[playerid][1], oRot[playerid][2]);
    
EditDynamicObject(playeridObjInfo[idx][obj]);
    
format(stringsizeof(string), " You are now editing object ID %d's position."idx);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
format(stringsizeof(string), "MapperWarn: %s is editting object ID %d's position.)"RPN(playerid), idx);
    
SendMapperMessage(COLOR_GREEN1string);
    return 
1;

Errors what i get.
PHP Code:
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5457) : error 017undefined symbol "VehInfo"
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5457) : warning 215expression has no effect
E
:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5457) : error 001expected token";"but found "]"
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5457) : error 029invalid expressionassumed zero
E
:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5457) : fatal error 107too many error messages on one line 
Reply
#2

Can you paste the enum for your dynamic vehicles.

EDIT: I just noticed the line.
EDIT2: I'm getting confused on
Code:
if(!VehInfo[idx][vModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle id.");
is it getting the vehicle model or the ID. I see the Message saying that its a invalid id but...
Reply
#3

EDIT: Reworked cmd based on the enums but.
PHP Code:
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5458) : error 017undefined symbol "vEdit"
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5458) : warning 215expression has no effect
E
:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5458) : error 001expected token";"but found "]"
E:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5458) : error 029invalid expressionassumed zero
E
:\Linux no SUNC\gamemodes\HTLS-RP.pwn(5458) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

PHP Code:
CMD:editveh(playeridparams[])
{
    new 
string[128], idx;
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
mDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on Mapper Duty.");
    if(
sscanf(params"i"idx)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /editveh [vehicleid]");
    if(!
vvvehInfo[idx][vvvModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid vehicle id.");
    
vEdit[playerid] = 1;
    
vEditID[playerid] = idx;
    
GetDynamicVehiclePos(vvvehInfo[idx][vvveh], vvvX[playerid][0], vvvY[playerid][1], vvvZ[playerid][2]);
    
GetDynamicVehicleRot(vvvehInfo[idx][vvveh], vvvAn[playerid][0], vvvC1[playerid][1], vvvC2[playerid][2]);
    
EditDynamicVehicle(playeridvvvehInfo[idx][vvveh]);
    
format(stringsizeof(string), " You are now editing vehicle ID %d's position."idx);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
format(stringsizeof(string), "MapperWarn: %s is editting vehicle ID %d's position.)"RPN(playerid), idx);
    
SendMapperMessage(COLOR_GREEN1string);
    return 
1;

Reply
#4

Have you defined vEdit in your script yet?

EDIT:

Quote:
Originally Posted by weedxd
View Post
EDIT2: Nvm i will do it on my own i got it all thanks for help anyways
No problem, glad to try and help people.
Reply
#5

Nah doin it atm.

EDIT: Can you plss rework this for me ?
EDIT2: Nvm i will do it on my own i got it all thanks for help anyways

PHP Code:
    idx oEditID[playerid];
    if(
response == EDIT_RESPONSE_UPDATE)
    {
        
SetDynamicObjectPos(objectidxyz);
        
SetDynamicObjectRot(objectidrxryrz);
    }
    else if(
response == EDIT_RESPONSE_CANCEL)
    {
        
SetDynamicObjectPos(objectidoPos[playerid][0], oPos[playerid][1], oPos[playerid][2]);
        
SetDynamicObjectRot(objectidoRot[playerid][0], oRot[playerid][1], oRot[playerid][2]);
        
oPos[playerid][0] = 0oPos[playerid][1] = 0oPos[playerid][2] = 0;
        
oRot[playerid][0] = 0oRot[playerid][1] = 0oRot[playerid][2] = 0;
        
format(stringsizeof(string), " You have canceled editing object ID %d."idx);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(
response == EDIT_RESPONSE_FINAL)
    {
        
SetDynamicObjectPos(objectidxyz);
        
SetDynamicObjectRot(objectidrxryrz);
        if(
oEdit[playerid] == 1)
        {
            
oldoID ObjInfo[idx][oModel];
            
ObjInfo[idx][oX] = x;
            
ObjInfo[idx][oY] = y;
            
ObjInfo[idx][oZ] = z;
            
ObjInfo[idx][oRX] = rx;
            
ObjInfo[idx][oRY] = ry;
            
ObjInfo[idx][oRZ] = rz;
              
oldodX ObjInfo[idx][oX];
              
oldodY ObjInfo[idx][oY];
              
oldodZ ObjInfo[idx][oZ];
              
oldodRX ObjInfo[idx][oRX];
              
oldodRY ObjInfo[idx][oRY];
              
oldodRZ ObjInfo[idx][oRZ];
            if(
IsValidDynamic3DTextLabel(ObjInfo[idx][oText])) DestroyDynamic3DTextLabel(ObjInfo[idx][oText]);
            
format(stringsizeof(string), "Object ID: %d (Model ID: %d)"idxObjInfo[idx][oModel]);
            
ObjInfo[idx][oText] = CreateDynamic3DTextLabel(stringCOLOR_WHITEObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], 10);
            
oEdit[playerid] = 0;
            
oEditID[playerid] = 0;
            
format(stringsizeof(string), " You have finished editing object ID %d's position."idx);
            
SendClientMessage(playeridCOLOR_WHITEstring);
        }
    } 
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)