CMD:criarcarros(playerid, params[]) { if(IsPlayerConnected(playerid)) { if(IsPlayerAdmin(playerid)) { AddStaticVehicle(556,1437.1012,-1086.3906,213.7894,2.4658,1,1); // carro AddStaticVehicle(556,1443.4580,-1086.5593,213.7459,0.0484,1,1); // carro AddStaticVehicle(556,1450.5344,-1086.3105,213.7841,359.3274,1,1); // carro AddStaticVehicle(556,1456.9467,-1086.4207,213.7845,357.6721,1,1); // carro AddStaticVehicle(556,1464.2859,-1086.6216,213.7841,357.4833,1,1); // carro AddStaticVehicle(556,1465.0902,-1047.4788,213.7931,178.4439,1,1); // carro AddStaticVehicle(556,1458.3571,-1048.3716,213.7840,178.6639,1,1); // carro AddStaticVehicle(556,1451.2590,-1048.7787,213.7515,178.9228,1,1); // carro AddStaticVehicle(556,1444.6572,-1048.8724,213.7498,178.0932,1,1); // carro AddStaticVehicle(556,1436.9729,-1048.5416,213.7840,177.9011,1,1); // carro } else { SendClientMessage(playerid, -1, "Vocк nгo esta Logado na RCON."); } } return 1; }
CMD:setarcarros(playerid)
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !");
{
AddStaticVehicle(556,1437.1012,-1086.3906,213.7894,2.4658,1,1); // carro
AddStaticVehicle(556,1443.4580,-1086.5593,213.7459,0.0484,1,1); // carro
AddStaticVehicle(556,1450.5344,-1086.3105,213.7841,359.3274,1,1); // carro
AddStaticVehicle(556,1456.9467,-1086.4207,213.7845,357.6721,1,1); // carro
AddStaticVehicle(556,1464.2859,-1086.6216,213.7841,357.4833,1,1); // carro
AddStaticVehicle(556,1465.0902,-1047.4788,213.7931,178.4439,1,1); // carro
AddStaticVehicle(556,1458.3571,-1048.3716,213.7840,178.6639,1,1); // carro
AddStaticVehicle(556,1451.2590,-1048.7787,213.7515,178.9228,1,1); // carro
AddStaticVehicle(556,1444.6572,-1048.8724,213.7498,178.0932,1,1); // carro
AddStaticVehicle(556,1436.9729,-1048.5416,213.7840,177.9011,1,1); // carro
}
return true;
}
PHP код:
|
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !");
Can only be used when the server first starts (under OnGameModeInit). |
sу pode ser usado quando o servidor inicia primeiro (sob OnGameModeInit). |
CMD:setarcarros(playerid)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !");
CreateVehicle(556,1437.1012,-1086.3906,213.7894,2.4658,1,1, 180); // carro
CreateVehicle(556,1443.4580,-1086.5593,213.7459,0.0484,1,1, 180); // carro
CreateVehicle(556,1450.5344,-1086.3105,213.7841,359.3274,1,1, 180); // carro
CreateVehicle(556,1456.9467,-1086.4207,213.7845,357.6721,1,1, 180); // carro
CreateVehicle(556,1464.2859,-1086.6216,213.7841,357.4833,1,1, 180); // carro
CreateVehicle(556,1465.0902,-1047.4788,213.7931,178.4439,1,1, 180); // carro
CreateVehicle(556,1458.3571,-1048.3716,213.7840,178.6639,1,1, 180); // carro
CreateVehicle(556,1451.2590,-1048.7787,213.7515,178.9228,1,1, 180); // carro
CreateVehicle(556,1444.6572,-1048.8724,213.7498,178.0932,1,1, 180); // carro
CreateVehicle(556,1436.9729,-1048.5416,213.7840,177.9011,1,1, 180); // carro
return true;
}
estб errado esse cуdigo seu! na parte
Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !"); Codigo correto seria. PHP код:
|
new carrosrcon[10]; // no comeзo do gm
CMD:setarcarros(playerid) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !"); carrosrcon[0] = CreateVehicle(556,1437.1012,-1086.3906,213.7894,2.4658,1,1, 180); // carro carrosrcon[1] = CreateVehicle(556,1443.4580,-1086.5593,213.7459,0.0484,1,1, 180); // carro carrosrcon[2] = CreateVehicle(556,1450.5344,-1086.3105,213.7841,359.3274,1,1, 180); // carro carrosrcon[3] = CreateVehicle(556,1456.9467,-1086.4207,213.7845,357.6721,1,1, 180); // carro carrosrcon[4] = CreateVehicle(556,1464.2859,-1086.6216,213.7841,357.4833,1,1, 180); // carro carrosrcon[5] = CreateVehicle(556,1465.0902,-1047.4788,213.7931,178.4439,1,1, 180); // carro carrosrcon[6] = CreateVehicle(556,1458.3571,-1048.3716,213.7840,178.6639,1,1, 180); // carro carrosrcon[7] = CreateVehicle(556,1451.2590,-1048.7787,213.7515,178.9228,1,1, 180); // carro carrosrcon[8] = CreateVehicle(556,1444.6572,-1048.8724,213.7498,178.0932,1,1, 180); // carro carrosrcon[9] = CreateVehicle(556,1436.9729,-1048.5416,213.7840,177.9011,1,1, 180); // carro return true; }
if(newstate == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID( playerid ); if(vehicleid == carrosrcon[0] || vehicleid == carrosrcon[1] || vehicleid == carrosrcon[2] || vehicleid == carrosrcon[3] || vehicleid == carrosrcon[4] || vehicleid == carrosrcon[5] || vehicleid == carrosrcon[6] || vehicleid == carrosrcon[7] || vehicleid == carrosrcon[8] || vehicleid == carrosrcon[9]){ if(IsPlayerAdmin(playerid)) { SendClientMessage(playerid, 0xFFFFFFFF, "• Sejб bem vindo(a) ao veiculo dos Admins!"); } else{ SendClientMessage(playerid, 0xFF0000FF, "• Vocк nгo tem permissгo para usar este veнculo!"); RemovePlayerFromVehicle( playerid ); TogglePlayerControllable(playerid, 1); } } }
if(carrosrcon[0] | carrosrcon[1] | carrosrcon[2] | carrosrcon[3] | carrosrcon[4] | carrosrcon[5] | carrosrcon[6] | carrosrcon[7] | carrosrcon[8] | carrosrcon[9] == vehicleid)
new Carros[10];
Comando by Glederson_dom(Com algumas adaptaзхes):
CMD:setarcarros(playerid)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nao й um ADM rcon !");
Carros[0] = CreateVehicle(556,1437.1012,-1086.3906,213.7894,2.4658,1,1, 180); // carro
Carros[1] = CreateVehicle(556,1443.4580,-1086.5593,213.7459,0.0484,1,1, 180); // carro
Carros[2] = CreateVehicle(556,1450.5344,-1086.3105,213.7841,359.3274,1,1, 180); // carro
Carros[3] = CreateVehicle(556,1456.9467,-1086.4207,213.7845,357.6721,1,1, 180); // carro
Carros[4] = CreateVehicle(556,1464.2859,-1086.6216,213.7841,357.4833,1,1, 180); // carro
Carros[5] = CreateVehicle(556,1465.0902,-1047.4788,213.7931,178.4439,1,1, 180); // carro
Carros[6] = CreateVehicle(556,1458.3571,-1048.3716,213.7840,178.6639,1,1, 180); // carro
Carros[7] = CreateVehicle(556,1451.2590,-1048.7787,213.7515,178.9228,1,1, 180); // carro
Carros[8] = CreateVehicle(556,1444.6572,-1048.8724,213.7498,178.0932,1,1, 180); // carro
Carros[9] = CreateVehicle(556,1436.9729,-1048.5416,213.7840,177.9011,1,1, 180); // carro
return true;
}
stock VeriVehicleid(vehicleid)
{
for(new i = 0; i<sizeof(Carros); i++)
{
if(vehicleid == Carros[i]) return true;
}
return false;
}
Agora na callback:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new carid = GetPlayerVehicleid(playerid);
if((newstate == PLAYER_STATE_DRIVER))
{
if(VeriVehicleid(carid) && !IsPlayerAdmin(playerid))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "Vocк nгo estб logado na RCON!");
}
}
}