13.12.2013, 12:22
Eu tenho esse FS de carmenu, eu entro em um carro, e digito /comprar, entao eu pago 20.000 pelo carro, saio do jogo e entro denovo, mas ele nгo salva o meu carro, ou seja, eu tenho que comprar o carro denovo :/ olha o FS :
Tem como o FS criar uma pasta e salvar o carro lб 
Eu jб tentei procurar ohar mecher mas nгo acho nada, :/, Jб procurei tutorias e nada, podem me ajudar
pawn Код:
//------------------------------------------------------------------------------
// Simple car commands FilterScritp
// packed indented and adapted by zeruel_angel
// CREDITS TO
// pekay http://forum.sa-mp.com/index.php?topic=26414.0
// Allan (/lock /unlock and strtok) http://forum.sa-mp.com/index.php?topic=2...8#msg18858
// Joshua Yu (/purchase and /callmycar) http://forum.sa-mp.com/index.php?topic=2...5#msg22605
// Alfredk (/eject) http://forum.sa-mp.com/index.php?topic=26402
//------------------------------------------------------------------------------
#include <a_samp>
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
#define COLOR_WHITE 0xFFFFFFAA
#define CAR_COST 20000
new owner[MAX_VEHICLES];
new ownedcar[MAX_PLAYERS];
new lockedCar[MAX_VEHICLES];
new wasInVehicle[MAX_PLAYERS];
//------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print(" ");
print(" ---------------------------------- ");
print(" CarMenu ligado ");
print(" ---------------------------------- ");
print(" ");
for (new i=0;i<MAX_PLAYERS;i++)
{
ownedcar[i]=-1;
wasInVehicle[i]=-1;
}
for (new i=0;i<MAX_VEHICLES;i++)
{
owner[i]=-1;
lockedCar[i]=0;
}
}
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_YELLOW,"Comandos do carro: /comandoscarro");
for (new i=0;i<700;i++)
{
if (lockedCar[i]==1)
{
SetVehicleParamsForPlayer( i, playerid, 0, 1);
}
}
}
//------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[255];
new tmp[255];
cmd = strtok(cmdtext,idx);
if (strcmp(cmdtext, "/comandoscarro", true)==0)
{
SendClientMessage(playerid, COLOR_GREEN,"Comandos disponiveis:");
SendClientMessage(playerid, COLOR_YELLOW,"/trancar, /destrancar, /comprar, /vendermeucarro, /localizarcarro, /ejetar, /ejetartodos");
return 1;
}
if (strcmp(cmdtext, "/trancar", true)==0)
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"Voce so pode fechar as portas como o motorista.");
return 1;
}
lockedCar[GetPlayerVehicleID(playerid)]=1;
new i;
for (i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Veiculo trancado!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "Voce nao esta em um veнculo!");
}
return 1;
}
if (strcmp(cmdtext, "/destrancar", true)==0)
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"Voce nao esta em um veiculo. Voce so pode abrir as portas como o motorista.");
return 1;
}
new i;
lockedCar[GetPlayerVehicleID(playerid)]=0;
for (i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
}
SendClientMessage(playerid, 0xFFFF00AA, "Veiculo destrancado!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "Voce nao esta em um veiculo!");
}
return 1;
}
if (strcmp(cmdtext, "/comprar", true)==0) // to set the vehicle that you register to be teleported
{
if (GetPlayerMoney(playerid) < CAR_COST)
{
SendClientMessage(playerid,COLOR_YELLOW,"Desculpe, voce nao tem dinheiro suficiente para comprar um carro.");
return 1;
}
if (!(IsPlayerInAnyVehicle(playerid)))
{
SendClientMessage(playerid,COLOR_YELLOW,"Por favor entre em um veiculo para compra-lo");
return 1;
}
if (owner[GetPlayerVehicleID(playerid)]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"Esse carro ja tem dono");
return 1;
}
if (ownedcar[playerid]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"Voce ja tem um carro, use /vendermeucarro para vende-lo.");
return 1;
}
ownedcar[playerid] = GetPlayerVehicleID(playerid);
owner[ownedcar[playerid]] = playerid;
SendClientMessage(playerid,COLOR_YELLOW,"Parabens! Voce comprou um carro novo.");
GivePlayerMoney(playerid,-CAR_COST);
return 1;
}
if (strcmp(cmdtext, "/vendermeucarro", true)==0)
{
if (ownedcar[playerid]==-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"Voce nao tem um carro...");
return 1;
}
if (lockedCar[ownedcar[playerid]]==1)
{
lockedCar[ownedcar[playerid]]=0;
for (new i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(ownedcar[playerid],i, 0, 0);
}
}
owner[ownedcar[playerid]] = -1;
ownedcar[playerid] = -1;
SendClientMessage(playerid,COLOR_YELLOW,"Voce vendeu seu carro, recebesse metade do seu dinheiro");
GivePlayerMoney(playerid,CAR_COST/2);
return 1;
}
if (strcmp(cmdtext, "/localizarcarro", true)==0)
{
if (ownedcar[playerid] != -1)
{
if (GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid,COLOR_YELLOW,"Desculpe, voce nгo tem dinheiro suficiente para usar o servico de teletransportar carro.");
}
else
{
new Float:playerpos[4];
GetPlayerPos(playerid,playerpos[0],playerpos[1],playerpos[2]);
GetPlayerFacingAngle(playerid,playerpos[3]);
SetVehicleZAngle(ownedcar[playerid],playerpos[3]+90.0);
SetVehiclePos(ownedcar[playerid],playerpos[0]+3.0*floatsin(-playerpos[3],degrees),playerpos[1]+3.0*floatcos(-playerpos[3],degrees),playerpos[2]+0.5); // This one is cool that I am using trigo functions to set the vehicle just before you.
SendClientMessage(playerid,COLOR_YELLOW,"Obrigado por utilizar o servico de teletransportar carro. Seu carro ja chegou.");
GivePlayerMoney(playerid,-1000);
}
}
}
if (strcmp(cmd,"/ejetar", true)==0){
new vehicleid;
new pid;
new playerstate = GetPlayerState(playerid);
tmp = strtok(cmdtext,idx);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"Voce nao esta em um veiculo");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Os passageiros nao podem usar isso!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
if (!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"Use: /ejetar [playerid]");
return 1;
}
pid = strval(tmp);
if (!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,"Esse jogador nao esta online ...");
return 1;
}
if (!IsPlayerInVehicle(pid,vehicleid))
{
SendClientMessage(playerid,COLOR_RED,"Esse jogador nao esta em seu veiculo ...");
return 1;
}
else
{
RemovePlayerFromVehicle(pid);
GameTextForPlayer(pid,"~r~Voce foi ejetado!",3000,5);
return 1;
}
}
if (strcmp(cmd,"/ejetartodos", true)==0){
new vehicleid;
new playerstate = GetPlayerState(playerid);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"Voce nao esta em um veiculo");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Os passageiros nao podem usar isso!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
for (new i=0;i<MAX_PLAYERS;i++)
{
if ((IsPlayerConnected(i))&&(IsPlayerInVehicle(i,vehicleid)))
{
RemovePlayerFromVehicle(i);
GameTextForPlayer(i,"~r~Voce foi ejetado!",3000,5);
return 1;
}
}
}
return 0;
}
//------------------------------------------------------------------------------
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate==PLAYER_STATE_DRIVER)
{
wasInVehicle[playerid]=GetPlayerVehicleID(playerid);
if ((owner[GetPlayerVehicleID(playerid)]!=-1)&&(owner[GetPlayerVehicleID(playerid)]!=playerid))
{
new name[MAX_PLAYER_NAME];
new msg[256];
GetPlayerName(owner[GetPlayerVehicleID(playerid)],name,sizeof(name));
format(msg,sizeof(msg),"Este veiculo pertence a: %s",name);
}
}
if (newstate==PLAYER_STATE_PASSENGER)
{
if ((owner[GetPlayerVehicleID(playerid)]!=-1)&&(owner[GetPlayerVehicleID(playerid)]!=playerid))
{
new name[MAX_PLAYER_NAME];
new msg[256];
GetPlayerName(owner[GetPlayerVehicleID(playerid)],name,sizeof(name));
format(msg,sizeof(msg),"Este veiculo pertence a: %s",name);
SendClientMessage(playerid,COLOR_YELLOW,msg);
}
}
if (newstate==PLAYER_STATE_ONFOOT)
{
if ((wasInVehicle[playerid]!=ownedcar[playerid])&&(lockedCar[wasInVehicle[playerid]]==1))
{
lockedCar[GetPlayerVehicleID(playerid)]=0;
for (new i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(ownedcar[playerid],i, 0, 0);
}
SendClientMessage(playerid, 0xFFFF00AA, "Veiculo destrancado!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
}
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
if ((ownedcar[playerid]!=-1)&&(lockedCar[ownedcar[playerid]]=1))
{
lockedCar[ownedcar[playerid]]=0;
for (new i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(ownedcar[playerid],i, 0, 0);
}
}
if (ownedcar[playerid]!=-1)
{
owner[ownedcar[playerid]]=-1;
ownedcar[playerid]=-1;
}
wasInVehicle[playerid]=-1;
return 1;
}
//------------------------------------------------------------------------------
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//------------------------------------------------------------------------------

Eu jб tentei procurar ohar mecher mas nгo acho nada, :/, Jб procurei tutorias e nada, podem me ajudar
