04.03.2014, 00:56
pawn Код:
new mesera;
new Text3D:BotLabel[MAX_PLAYERS];
public OnGameModeInit()
{
ConnectNPC("Jenny_Laurent","mesera");
mesera = AddStaticVehicle(420,2044.8854,1473.2106,10.4494,181.3339,6,1); // van
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
new string[32], NPCName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NPCName, sizeof NPCName);
format(string, sizeof string, "%s (%d)", NPCName, playerid);
BotLabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0, 0, 0, 40, 0, true);
Attach3DTextLabelToPlayer(BotLabel[playerid], playerid, 0, 0, 0.4);
SetPlayerColor(playerid, COLOR_WHITE);
}
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Gets the NPC's name
if(!strcmp(npcname, "Jenny_Laurent", true)) //Checks if the NPC's name is Driver
{
PutPlayerInVehicle(playerid, mesera, 0); //Puts the NPC into the van.
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}