08.12.2011, 12:33
(
Последний раз редактировалось Cristhian; 08.12.2011 в 17:34.
Причина: agora vai .-.
)
pawn Код:
new bool:VeiculoID[MAX_PLAYERS][MAX_VEHICLES];
new car;
pawn Код:
public OnPlayerConnect(playerid)
{
for(new v = 0; v < MAX_VEHICLES; v++)
{
VeiculoID[playerid][v] = false;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyVehicle(VeiculoID[playerid][car]);
VeiculoID[playerid][car] = false;
return 1;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new
cmd[128], idx, tmp[128];
cmd = strtok(cmdtext, idx);
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
if(strcmp(cmd, "/veh", true) == 0 || strcmp(cmd, "/criarveiculo", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /veh [id veнculo] [cor1] [cor2]");
return 1;
}
new
veiculo = strval(tmp);
if(veiculo < 400 || veiculo > 611)
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Somente veнculos entre os ID: 400 б 611");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /veh [id veнculo] [cor1] [cor2]");
return 1;
}
new
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
new
color2 = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /veh [id veнculo] [cor1] [cor2]");
return 1;
}
car = veiculo;
DestroyVehicle(VeiculoID[playerid][car]);
vModel = CreateVehicle(veiculo, ppos[0], ppos[1], ppos[2], 360, color1, color2, -1);
PutPlayerInVehicle(playerid, vModel, 0);
VeiculoID[playerid][car] = true;
format(gstring, sizeof(gstring), "| INFO | %s id: %d cor1 %d e cor2 %d criado com sucesso!", Veiculos[GetVehicleModel(vModel)-400], veiculo, color1, color2);
SendClientMessage(playerid, 0xFFFF33AA, gstring);
format(gstring, 256, "{FFFF33}Veнculo de {FFFFCC}%s {FFFF33}id {FFFFCC}%d", PlayerName(playerid), playerid);
TextVeH = Create3DTextLabel(gstring, -1, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(TextVeH, vModel, 0.0, 0.0, 0.0+1);
return 1;
}
return 0;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleID(playerid) == car)
{
return 1;
}
else
{
format(gstring, sizeof(gstring), "| ERRO | Esse veнculo pertence а %s e vocк nгo pode dirigi-lo! {99FF66}( Crie o seu usando: /Veh )", PlayerName(VeiculoID[playerid][car]));
SendClientMessage(playerid, 0xFF6633AA, gstring);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
RemovePlayerFromVehicle(playerid);
return 1;
}
}
return 1;
}
editei ali /\