27.10.2013, 19:29
Quote:
Destroi ao desconectar, й melhor. Se nгo o cara cria o carro, sai, ninguem entra no lugar dele e digita para criar outro carro e acaba ficando lб
|
pawn Код:
new
_uservehicle[ MAX_PLAYERS ]
;
public OnPlayerConnect(playerid){
return DestroyVehicle(_uservehicle[ playerid ]), _uservehicle[ playerid ] = -1;
}
public OnPlayerCommandText(playerid, cmdtext[]){
if(!strfind(cmdtext, "/cv", true)){
if(strlen(cmdtext) == 3 || strlen(cmdtext) == 4)
{
return SendClientMessage(playerid, -1, "(Erro): digite: /cv <modelo>");
}
strdel(cmdtext, 0, 3);
static
_model
;
_model = strval(cmdtext);
if(!(400 < _model < 600)){
return SendClientMessage(playerid, -1,"(Erro): modelo invбlido");
}
if(_uservehicle[playerid] != -1){
DestroyVehicle(_uservehicle[playerid]);
_uservehicle[playerid] = -1;
}
static
Float: _pos[3]
;
GetPlayerPos(playerid, _pos[0], _pos[1], _pos[2]);
_uservehicle[playerid] = CreateVehicle(_model, _pos[0], _pos[1], _pos[2], 0.0, -1, -1, 0);
PutPlayerInVehicle(playerid, _uservehicle[playerid], 0);
SendClientMessage(playerid, -1, #Divirta-se com seu novo veнculo!);
return true;
}
return false;
}
public OnPlayerExitVehicle(playerid, vehicleid){
if(_uservehicle[playerid] == vehicleid){
DestroyVehicle(vehicleid);
_uservehicle[playerid] = -1;
}
return true;
}