Creating individual world for events
#10

Код:
//On top of your script:
new CopChaseInviter[MAX_PLAYERS] = INVALID_PLAYER_ID;

// Anywhere if you don't have something like GetPlayerNameEx
stock GetPlayerNameEx(playerid)
{
    new playerName[MAX_PLAYER_NAME];

    if(IsPlayerConnected(playerid))
    {
		GetPlayerName(playerid, playerName, sizeof(playerName));
	}
	return playerName;
}

//next to your commands
CMD:copchase(playerid, params[])
{
       new string[128], playerb;
	if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, -1, "USAGE: /copchase [playerid]");
        CopChaseInviter[playerb] = playerid;
        format(string,sizeof(string),"%s has requested to join your CopChase game", GetPlayerNameEx(playerid));
        SendClientMessage(playerid, -1, string);
        return 1;
}

CMD:acceptcopchase(playerid, params[])
{
    new playerb = CopChaseInviter[playerid];
    SetPlayerPos(playerb, 0, 0, 5); //for example
    SetPlayerVirtualWorld(playerb, playerid+1);// I added +1 so player ID 0 won't stay in the real virtual world
    if (GetPlayerState(playerb) == 2)
    {
	new tmpcar = GetPlayerVehicleID(playerb);
	SetVehiclePos(tmpcar, 0, 0, 10);
	LinkVehicleToInterior(tempcar, GetPlayerInterior(playerb));
	SetVehicleVirtualWorld(tempcar,playerid+1);
     }
     return 1;
}
I did not test this and it still need improvement like checking if the first player is even in a CopChase game or not etc....But this will give you an idea on how to do it
Reply


Messages In This Thread
Creating individual world for events - by Ciarannn - 16.03.2014, 13:14
Re: Creating individual world for events - by Abagail - 16.03.2014, 13:16
Respuesta: Creating individual world for events - by Stront - 16.03.2014, 13:51
Re: Creating individual world for events - by mirou123 - 16.03.2014, 13:58
Re: Creating individual world for events - by Ciarannn - 16.03.2014, 14:25
Re: Creating individual world for events - by mirou123 - 16.03.2014, 14:41
Re: Creating individual world for events - by Ciarannn - 16.03.2014, 14:41
Re: Creating individual world for events - by mirou123 - 16.03.2014, 14:49
Re: Creating individual world for events - by Ciarannn - 16.03.2014, 14:59
Re: Creating individual world for events - by mirou123 - 16.03.2014, 15:24

Forum Jump:


Users browsing this thread: 2 Guest(s)