Virtualworld problem
#1

Hello, I have been searching where I can find this problem but I give up...

I have searched on wiki sites but can't get it straight.

When I enter a vehicle and change my virtual world the vehicle stays in virtual world 0.

I also want to make an option to park vehicles in other virtual worlds how can I do all this ?
Reply
#2

Can you show the virtual world command please?
Reply
#3

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Can you show the virtual world command please?
PHP код:
CMD:setvw(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command.");
    new 
giveplayeridvw;
    if(
sscanf(params"ud"giveplayeridvw)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /setvw [player] [virtual world]");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playeridCOLOR_GREY"Invalid player specified.");
    new 
string[128];
    if(
GetPVarInt(giveplayerid"IsInArena") >= 0)
    {
        
SetPVarInt(playerid"tempPBP"giveplayerid);
        
format(stringsizeof(string), "%s (ID: %d) is currently in an active Paintball game.\n\nDo you want to force this player out?"GetPlayerNameEx(giveplayerid), giveplayerid);
        
ShowPlayerDialog(playeridPBFORCEDIALOG_STYLE_MSGBOX"Paintball"string"Yes""No");
        return 
1;
    }
    
PlayerInfo[giveplayerid][pVW] =  vw;
    
SetPlayerVirtualWorld(giveplayerid,  vw);
    
format(stringsizeof(string), "You have set %s's virtual world to %d."GetPlayerNameEx(giveplayerid),  vw);
    
SendClientMessageEx(playeridCOLOR_GRAD2string);
    return 
1;

Reply
#4

Add this under 'new giveplayerid...'

Код:
new cvw = GetPlayerVehicleID(playerid);
Add this:

Код:
if(IsPlayerInVehicle(playerid))
{
     PlayerInfo[giveplayerid][pVW] =  vw; 
     SetPlayerVirtualWorld(giveplayerid,  vw); 
     format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
     SendClientMessageEx(playerid, COLOR_GRAD2, string); 
     SetVehicleVirtualWorld(cvw, vw);
}
Example of command:
Код:
CMD:setvw(playerid, params[]) 
{ 
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command."); 
    new giveplayerid, vw; 
    if(sscanf(params, "ud", giveplayerid, vw)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setvw [player] [virtual world]"); 
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified."); 
    new string[128]; 
    if(GetPVarInt(giveplayerid, "IsInArena") >= 0) 
    { 
        SetPVarInt(playerid, "tempPBP", giveplayerid); 
        format(string, sizeof(string), "%s (ID: %d) is currently in an active Paintball game.\n\nDo you want to force this player out?", GetPlayerNameEx(giveplayerid), giveplayerid); 
        ShowPlayerDialog(playerid, PBFORCE, DIALOG_STYLE_MSGBOX, "Paintball", string, "Yes", "No"); 
        return 1; 
    } 
    if(IsPlayerInVehicle(playerid))
    {
     PlayerInfo[giveplayerid][pVW] =  vw; 
     SetPlayerVirtualWorld(giveplayerid,  vw); 
     format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
     SendClientMessageEx(playerid, COLOR_GRAD2, string); 
     SetVehicleVirtualWorld(cvw, vw);
    }
else
{
    PlayerInfo[giveplayerid][pVW] =  vw; 
    SetPlayerVirtualWorld(giveplayerid,  vw); 
    format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
    SendClientMessageEx(playerid, COLOR_GRAD2, string); 
    return 1; 
}
}
Adjust it a bit in pawno, post errors here if any
Reply
#5

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Add this under 'new giveplayerid...'

Код:
new cvw = GetPlayerVehicleID(playerid);
Add this:

Код:
if(IsPlayerInVehicle(playerid))
{
     PlayerInfo[giveplayerid][pVW] =  vw; 
     SetPlayerVirtualWorld(giveplayerid,  vw); 
     format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
     SendClientMessageEx(playerid, COLOR_GRAD2, string); 
     SetVehicleVirtualWorld(cvw, vw);
}
Example of command:
Код:
CMD:setvw(playerid, params[]) 
{ 
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command."); 
    new giveplayerid, vw; 
    if(sscanf(params, "ud", giveplayerid, vw)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setvw [player] [virtual world]"); 
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified."); 
    new string[128]; 
    if(GetPVarInt(giveplayerid, "IsInArena") >= 0) 
    { 
        SetPVarInt(playerid, "tempPBP", giveplayerid); 
        format(string, sizeof(string), "%s (ID: %d) is currently in an active Paintball game.\n\nDo you want to force this player out?", GetPlayerNameEx(giveplayerid), giveplayerid); 
        ShowPlayerDialog(playerid, PBFORCE, DIALOG_STYLE_MSGBOX, "Paintball", string, "Yes", "No"); 
        return 1; 
    } 
    if(IsPlayerInVehicle(playerid))
    {
     PlayerInfo[giveplayerid][pVW] =  vw; 
     SetPlayerVirtualWorld(giveplayerid,  vw); 
     format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
     SendClientMessageEx(playerid, COLOR_GRAD2, string); 
     SetVehicleVirtualWorld(cvw, vw);
    }
else
{
    PlayerInfo[giveplayerid][pVW] =  vw; 
    SetPlayerVirtualWorld(giveplayerid,  vw); 
    format(string, sizeof(string), "You have set %s's virtual world to %d.", GetPlayerNameEx(giveplayerid),  vw); 
    SendClientMessageEx(playerid, COLOR_GRAD2, string); 
    return 1; 
}
}
Adjust it a bit in pawno, post errors here if any
Getting 1 warning see line

Код:
Roleplay\gamemodes\RP.pwn(39154) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
PHP код:
CMD:setvw(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
        {
            
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
        }
        new 
string[128], giveplayeridvw;
        new 
cvw GetPlayerVehicleID(playerid);
        if(
sscanf(params"ud"giveplayeridvw)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /setvw [playerid/partofname] [virtual world]");
>>        if(
IsPlayerInVehicle(playerid))
        {
             
PlayerInfo[giveplayerid][pVW] =  vw;
             
SetPlayerVirtualWorld(giveplayerid,  vw);
             
format(stringsizeof(string), "You have set %s's virtual world to %d."GetPlayerNameEx(giveplayerid),  vw);
             
SendClientMessageEx(playeridCOLOR_GRAD2string);
             
SetVehicleVirtualWorld(cvwvw);
        }
        if(
IsPlayerConnected(giveplayerid))
        {
            
PlayerInfo[giveplayerid][pVW] =  vw;
            
SetPlayerVirtualWorld(giveplayerid,  vw);
            
format(stringsizeof(string), "You have set %s's virtual world to %d."GetPlayerNameEx(giveplayerid),  vw);
            
SendClientMessage(playeridCOLOR_GRAD2string);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    }
    return 
1;

Reply
#6

Replace this:
Код:
if(IsPlayerInVehicle(playerid))
with:
Код:
if(IsPlayerInAnyVehicle(playerid))
Reply
#7

Alright that problem has been fixed, leave me by the last one.

/park command I have tried to add it to there but once the car is spawned and I set my virtual world to 100 for example and park it the car goes back to VW 0


PHP код:
CMD:park(playeridparams[])
{
    if(
PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
    {
        new 
ownerid PlayerInfo[playerid][pVehicleKeysFrom];
        if(
IsPlayerConnected(ownerid))
        {
            new 
PlayerInfo[playerid][pVehicleKeys];
            new 
cvw GetPlayerVehicleID(playerid);
            if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[ownerid][d][pvId]))
            {
                if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_GREY"You must be in the driver seat.");
                new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
                
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
                if(
health 800) return SendClientMessage(playeridCOLOR_GREY" Your vehicle is too damaged to park it.");
                if(
PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
                if(
IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
                
{
                    new 
Float:vehPos[3];
                    
GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
                    
SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5vehPos[2]+0.5);
                }
>>                new 
vw;
>>                
PlayerInfo[playerid][pVW] =  vw;
                
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], xyz);
                
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
                
SurfingCheck(GetPlayerVehicleID(playerid));
                
UpdatePlayerVehicleParkPosition(owneriddxyzanglehealth);
                
PutPlayerInVehicle(playeridGetPlayerVehicleID(playerid), 0);
                 
SetPlayerArmedWeapon(playerid0);
>>                 
SetVehicleVirtualWorld(cvwvw);
                new 
string[29 + (MAX_PLAYER_NAME 2)];
                
format(stringsizeof(string), "* %s has parked %s's vehicle."GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 
1;
            }
        }
    }
    for(new 
MAX_PLAYERVEHICLESd++)
    {
        if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId]))
        {
            new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
            
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_GREY"You must be in the driver seat.");
            if(
health 800) return SendClientMessage(playeridCOLOR_GREY" Your vehicle is too damaged to park it.");
            if(
PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
            
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], xyz);
            
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
            
SurfingCheck(GetPlayerVehicleID(playerid));
            
UpdatePlayerVehicleParkPosition(playeriddxyzanglehealth);
            
PutPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId], 0);
            
SetPlayerArmedWeapon(playerid0);
            new 
string[30 + (MAX_PLAYER_NAME 2)];
            
format(stringsizeof(string), "* %s has parked their vehicle."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 
1;
        }
    }
    
SendClientMessage(playeridCOLOR_GREY"You need to be inside a vehicle that you own.");
    return 
1;

Reply
#8

Anyone ?
Reply
#9

Bump
Reply
#10

Anyone ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)