27.10.2013, 19:00
Carro temporбrio
pawn Код:
new
_uservehicle[ MAX_PLAYERS ]
;
public OnPlayerConnect(playerid){
return _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;
}