15.11.2013, 05:41
I want to know how to fix the virtual world
like /fixvw
like /fixvw
CMD:setvw(playerid, params[]) { if(IsPlayerAdmin(playerid)) //This will check if player is RCON logged { new string[128], giveplayerid, vw; //this will get the player's id if(sscanf(params, "ud", giveplayerid, vw)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setvw [playerid] [virtual world]"); if(IsPlayerConnected(giveplayerid))// this check if player is connected { PlayerInfo[giveplayerid][pVW] = vw; SetPlayerVirtualWorld(giveplayerid, vw); //this set the plyer's virtual world format(string, sizeof(string), "You have set %s's virtual world to %d.", //this notifies the playerGetPlayerNameEx(giveplayerid), vw); SendClientMessageEx(playerid, COLOR_GRAD2, string); } } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); //if the player is not RCON logged, the client will send him this message } return 1; }
CMD:fixvw( playerid, params[ ] )
{
new
worldid
;
if( sscanf( params, "i", worldid ) ) return SendClientMessage( playerid, -1, "Usage: /fixvw <worldid>" );
if( GetPlayerVirtualWorld( playerid ) == worldid ) return SendClientMessage( playerid, -1, "You're already in that virtual world" );
switch( GetPlayerState( playerid ) )
{
case PLAYER_STATE_ONFOOT: SetPlayerVirtualWorld( playerid, worldid );
case PLAYER_STATE_DRIVER:
{
new
vehicleid = GetPlayerVehicleID( playerid )
;
SetVehicleVirtualWorld( vehicleid, worldid );
SetPlayerVirtualWorld( playerid, worldid );
PutPlayerInVehicle( playerid, vehicleid, 0 );
}
case PLAYER_STATE_PASSENGER:
{
RemovePlayerFromVehicle( playerid );
SetPlayerVirtualWorld( playerid, worldid );
}
default: SendClientMessage( playerid, -1, "You cannot change the virtual world at the moment!" );
}
return 1;
}
CMD:fixmyvw(playerid, params[])
{
new string[128];
if(IsPlayerConnected(playerid))
{
PlayerInfo[playerid][pInt] = 0;
SetPlayerInterior(playerid, 0);
PlayerInfo[playerid][pVW] = 0;
SetPlayerVirtualWorld(playerid, 0);
format(string, sizeof(string), "You have fixed your virtual world.");
SendClientMessage(playerid, COLOR_GRAD2, string);
}
return 1;
}