PDA

View Full Version : can some these things into CMD not strcmp because its already strcmp.with sscanf+zcmd.


mittukuttan
25/01/2013, 03:52 AM
---------------------------------------------------------------------------

#include <a_samp>

#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
#define COLOR_WHITE 0xFFFFFFAA
#define CAR_COST 50000

new owner[MAX_VEHICLES];
new ownedcar[MAX_PLAYERS];
new lockedCar[MAX_VEHICLES];
new wasInVehicle[MAX_PLAYERS];

//------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print(" ");
print(" ---------------------------------- ");
print(" Car Commands Filterscript ");
print(" Packed indented and adapted ");
print(" by zeruel_angel ");
print(" Credits to: ");
print(" pekay, Allan, Joshua Yu, Alfredk ");
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,"Car Help Here /carhelp");
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, "/carhelp", true)==0)
{
SendClientMessage(playerid, COLOR_GREEN,"Available commands:");
SendClientMessage(playerid, COLOR_YELLOW,"/lock, /unlock, /purchase, /sellmycar, /callmycar, /eject, /ejectall");
return 1;
}

if (strcmp(cmdtext, "/lock", true)==0)
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
return 1;
}
lockedCar[GetPlayerVehicleID(playerid)]=1;
new i;
for (i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 1);
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
}
return 1;
}

if (strcmp(cmdtext, "/unlock", true)==0)
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"You can only unlock the doors as the driver.");
return 1;
}
new i;
lockedCar[GetPlayerVehicleID(playerid)]=0;
for (i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 0);
}
SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
}
return 1;
}
if (strcmp(cmdtext, "/purchase", true)==0) // to set the vehicle that you register to be teleported
{
if (GetPlayerMoney(playerid) < CAR_COST)
{
SendClientMessage(playerid,COLOR_YELLOW,"Sorry, you don't have enough money to buy a car.");
return 1;
}
if (!(IsPlayerInAnyVehicle(playerid)))
{
SendClientMessage(playerid,COLOR_YELLOW,"Please get in a vehicle to buy it.");
return 1;
}
if (owner[GetPlayerVehicleID(playerid)]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"This car already have an owner");
return 1;
}
if (ownedcar[playerid]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"You already have a car, use /sellmycar to sell it in any moment.");
return 1;
}
ownedcar[playerid] = GetPlayerVehicleID(playerid);
owner[ownedcar[playerid]] = playerid;
SendClientMessage(playerid,COLOR_YELLOW,"Congragulations! You have purchased a new car.");
GivePlayerMoney(playerid,-CAR_COST);
return 1;
}
if (strcmp(cmdtext, "/sellmycar", true)==0)
{
if (ownedcar[playerid]==-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"You don't have any car...");
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,"You have sold your car, you get back half of your money");
GivePlayerMoney(playerid,CAR_COST/2);
return 1;
}
if (strcmp(cmdtext, "/callmycar", true)==0)
{
if (ownedcar[playerid] != -1)
{
if (GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid,COLOR_YELLOW,"Sorry, you don't have enough money to use the car teleport service.");
}
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,"Thank you for using car teleport service. Your car has came.");
GivePlayerMoney(playerid,-1000);
}
}
}

if (strcmp(cmd,"/eject", true)==0){
new vehicleid;
new pid;
new playerstate = GetPlayerState(playerid);
tmp = strtok(cmdtext,idx);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
if (!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"USAGE: /eject [playerid]");
return 1;
}
pid = strval(tmp);
if (!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not Connected...");
return 1;
}
if (!IsPlayerInVehicle(pid,vehicleid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not In Your Vehicle...");
return 1;
}
else
{
RemovePlayerFromVehicle(pid);
GameTextForPlayer(pid,"~r~YOU'VE BEEN EJECTED!",3000,5);
return 1;
}
}
if (strcmp(cmd,"/ejectall", true)==0){
new vehicleid;
new playerstate = GetPlayerState(playerid);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
for (new i=0;i<MAX_PLAYERS;i++)
{
if ((IsPlayerConnected(i))&&(IsPlayerInVehicle(i,vehicleid)))
{
RemovePlayerFromVehicle(i);
GameTextForPlayer(i,"~r~YOU'VE BEEN EJECTED!",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),"This vehicle belongs to: %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),"This vehicle belongs to: %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, "Vehicle unlocked!");
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;
}

with sscanf+zcmd plz.

Scenario
25/01/2013, 04:10 AM
All you had to do was replace a few things...


#include <a_samp>
#include <zcmd>

#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
#define COLOR_WHITE 0xFFFFFFAA
#define CAR_COST 50000

new owner[MAX_VEHICLES];
new ownedcar[MAX_PLAYERS];
new lockedCar[MAX_VEHICLES];
new wasInVehicle[MAX_PLAYERS];

//------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print(" ");
print(" ---------------------------------- ");
print(" Car Commands Filterscript ");
print(" Packed indented and adapted ");
print(" by zeruel_angel ");
print(" Credits to: ");
print(" pekay, Allan, Joshua Yu, Alfredk ");
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,"Car Help Here /carhelp");
for (new i=0;i<700;i++)
{
if (lockedCar[i]==1)
{
SetVehicleParamsForPlayer( i, playerid, 0, 1);
}
}
}
//------------------------------------------------------------------------------


stock bool:IsNumeric( const szString[ ] ) // credits to Slice
{
if ( !szString[ 0 ] )
return false;

new
iLength = strlen( szString ),
i
;

if ( szString[ 0 ] == '-' && szString[ 1 ] )
i = 1;

for ( ; i < iLength; i++ )
{
if ( !( '0' <= szString[ i ] <= '9' ) )
return false;
}

return true;
}

CMD:carhelp(playerid, params[])
{
SendClientMessage(playerid, COLOR_GREEN,"Available commands:");
SendClientMessage(playerid, COLOR_YELLOW,"/lock, /unlock, /purchase, /sellmycar, /callmycar, /eject, /ejectall");
return 1;
}

CMD:lock(playerid, params[])
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
return 1;
}
lockedCar[GetPlayerVehicleID(playerid)]=1;
new i;
for (i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 1);
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
}
return 1;
}

CMD:unlock(playerid, params[])
{
if (IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"You can only unlock the doors as the driver.");
return 1;
}
new i;
lockedCar[GetPlayerVehicleID(playerid)]=0;
for (i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 0);
}
SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
}
return 1;
}
CMD:purchase(playerid, params[]) // to set the vehicle that you register to be teleported
{
if (GetPlayerMoney(playerid) < CAR_COST)
{
SendClientMessage(playerid,COLOR_YELLOW,"Sorry, you don't have enough money to buy a car.");
return 1;
}
if (!(IsPlayerInAnyVehicle(playerid)))
{
SendClientMessage(playerid,COLOR_YELLOW,"Please get in a vehicle to buy it.");
return 1;
}
if (owner[GetPlayerVehicleID(playerid)]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"This car already have an owner");
return 1;
}
if (ownedcar[playerid]!=-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"You already have a car, use /sellmycar to sell it in any moment.");
return 1;
}
ownedcar[playerid] = GetPlayerVehicleID(playerid);
owner[ownedcar[playerid]] = playerid;
SendClientMessage(playerid,COLOR_YELLOW,"Congragulations! You have purchased a new car.");
GivePlayerMoney(playerid,-CAR_COST);
return 1;
}
CMD:sellmycar(playerid, params[])
{
if (ownedcar[playerid]==-1)
{
SendClientMessage(playerid,COLOR_YELLOW,"You don't have any car...");
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,"You have sold your car, you get back half of your money");
GivePlayerMoney(playerid,CAR_COST/2);
return 1;
}
CMD:callmycar(playerid, params[])
{
if (ownedcar[playerid] != -1)
{
if (GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid,COLOR_YELLOW,"Sorry, you don't have enough money to use the car teleport service.");
}
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,"Thank you for using car teleport service. Your car has came.");
GivePlayerMoney(playerid,-1000);
}
}
return 1;
}

CMD:eject(playerid, params[]){
new vehicleid;
new pid;
new playerstate = GetPlayerState(playerid);
if(strlen(params) > 0 && IsNumeric(params)) new tmp = strval(params);
else return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /eject [playerid]");

if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
new pid = tmp;
if (!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not Connected...");
return 1;
}
if (!IsPlayerInVehicle(pid,vehicleid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not In Your Vehicle...");
return 1;
}
else
{
RemovePlayerFromVehicle(pid);
GameTextForPlayer(pid,"~r~YOU'VE BEEN EJECTED!",3000,5);
return 1;
}
return 1;
}
CMD:ejectall(playerid, params[]){
new vehicleid;
new playerstate = GetPlayerState(playerid);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
for (new i=0;i<MAX_PLAYERS;i++)
{
if ((IsPlayerConnected(i))&&(IsPlayerInVehicle(i,vehicleid)))
{
RemovePlayerFromVehicle(i);
GameTextForPlayer(i,"~r~YOU'VE BEEN EJECTED!",3000,5);
return 1;
}
}
return 1;
}


//------------------------------------------------------------------------------
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),"This vehicle belongs to: %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),"This vehicle belongs to: %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, "Vehicle unlocked!");
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;
}

mittukuttan
25/01/2013, 03:48 PM
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(622) : warning 225: unreachable code
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1338) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1345) : error 003: declaration of a local variable must appear in a compound block
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1345) : error 017: undefined symbol "tmp"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1346) : error 029: invalid expression, assumed zero
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1346) : warning 215: expression has no effect
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1346) : error 001: expected token: ";", but found "return"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1348) : warning 225: unreachable code
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1359) : error 021: symbol already defined: "pid"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1376) : warning 225: unreachable code
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1376) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1343) : warning 203: symbol is never used: "pid"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1401) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\lfgr.pwn(1405) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

Sime30
25/01/2013, 04:03 PM
Beware how you put into your script (lines, columns etc. )
Put these first and say if they work


CMD:carhelp(playerid, params[])
{
SendClientMessage(playerid, COLOR_GREEN,"Available commands:");
SendClientMessage(playerid, COLOR_YELLOW,"/lock, /unlock, /purchase, /sellmycar, /callmycar, /eject, /ejectall");
return 1;
}


CMD:lock(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
return 1;
}
lockedCar[GetPlayerVehicleID(playerid)]=1;
new i;
for (i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i, 0, 1);
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
}
return 1;
}

mittukuttan
15/02/2013, 02:39 PM
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(208) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(215) : error 003: declaration of a local variable must appear in a compound block
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(215) : error 017: undefined symbol "tmp"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(216) : error 029: invalid expression, assumed zero
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(216) : warning 215: expression has no effect
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(216) : error 001: expected token: ";", but found "return"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(218) : warning 225: unreachable code
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(229) : error 021: symbol already defined: "pid"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(246) : warning 225: unreachable code
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(246) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(213) : warning 203: symbol is never used: "pid"
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(271) : warning 217: loose indentation
C:\Users\intel\Desktop\New Folder\Roleplay Base Script\gamemodes\Untitled.pwn(356) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

mittukuttan
21/02/2013, 10:52 AM
help me pls