anuncio

sábado, 19 de março de 2011

Criando Carros ( Completo )

Topo do GM/FS

new CarrosPs[MAX_PLAYERS];


public OnPlayerCommandText

if (strcmp(cmdtext, "/carros", true) == 0)
{
ShowPlayerDialog(playerid,158,DIALOG_STYLE_LIST,"Pegar carros","\nElegy\nNRG-500","Ok","Sair");
return 1;
}


public OnDialogResponse

if(dialogid == 158)
{
if(response)
{
if(listitem == 0)
{
if(CarrosPs[playerid] != INVALID_VEHICLE_ID)
DestroyVehicle(CarrosPs[playerid]);
new Float:X,Float:Y,Float:Z,Float:Angle;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
GetPlayerVehicleID(playerid);
CarrosPs[playerid] = CreateVehicle(562,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid, CarrosPs[playerid], 0);
}
}
if(listitem == 1)
{
if(CarrosPs[playerid] != INVALID_VEHICLE_ID)
DestroyVehicle(CarrosPs[playerid]);
new Float:X,Float:Y,Float:Z,Float:Angle;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
GetPlayerVehicleID(playerid);
CarrosPs[playerid] = CreateVehicle(522,X,Y,Z,Angle,-1,-1,600);
PutPlayerInVehicle(playerid, CarrosPs[playerid], 0);
}
}



public OnPlayerExitVehicle

SetTimerEx("psDestroyVehicle", 20000, 0, "i", vehicleid);


Final do GM/FS

forward psDestroyVehicle(vehicleid);
public psDestroyVehicle(vehicleid)
{
return DestroyVehicle(vehicleid);
}

2 comentários:

CuCo disse...

Desculpe mas está dando erro na hora de compilar.
C:\Documents and Settings\CuCo\Desktop\carros.pwn(180) : error 017: undefined symbol "CarrosPs"
C:\Documents and Settings\CuCo\Desktop\carros.pwn(180) : warning 215: expression has no effect
C:\Documents and Settings\CuCo\Desktop\carros.pwn(180) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\CuCo\Desktop\carros.pwn(180) : error 029: invalid expression, assumed zero
C:\Documents and Settings\CuCo\Desktop\carros.pwn(180) : fatal error 107: too many error messages on one line

CuCo disse...

linha 180= if(CarrosPs[playerid] != INVALID_VEHICLE_ID)

Postar um comentário

:a   :b   :c   :d   :e   :f   :g   :h   :i   :j   :k   :l   :m   :n   :o   :p   :q   :r   :s   :t