enum pInfo
{
//(...)
pAchievement0,
pAchievement1,
pAchievement2,
pAchievement3,
pAchievement4,
pAchievement5,
pAchievement6,
pAchievement7,
pAchievement8,
pAchievement9,
pAchievement10,
pAchievement11,
pAchievement12,
pAchievement13,
pAchievement14,
pAchievement15,
pAchievement16,
pAchievement17,
pAchievement18,
pAchievement19,
pAchievement20,
pShiftName,
pWeapon,
pWeapon2,
pWeapon3,
pWeapon4,
pWeapon5,
pWeapon6,
pWeapon7,
pWeapon8,
pWeapon9,
pWeapon10,
pWeapon11,
pWeapon12,
pAmmo,
pAmmo2,
pAmmo3,
pAmmo4,
pAmmo5,
pAmmo6,
pAmmo7,
pAmmo8,
pAmmo9,
pAmmo10,
pAmmo11,
pAmmo12,
//(...)
}
new RandomFemaleSkins[][] =
{
{9},{10},{11},{38},{39},{40},{54},{55},{56},{63},{64},{75},{76},{77},
{85},{87},{88},{90},{93},{131},{130},{138},{139},{141},{145},{148},{149},
{152},{157},{169},{172},{178},{190},{192},{193},{194},{199},{198},{201},
{207},{211},{215},{219},{225},{226},{233},{237},{244},{246},{251},{257},
{263}
};
new DBResult:result = db_query(ServerDB, "SELECT * FROM `PermCars`");
id = db_num_rows(result) + 1;
format(string, sizeof(string), "SELECT * FROM `PermCars` WHERE `PermCarID` = '%d'", id);
dbResult[0] = db_query(ServerDB, string);
if (db_num_rows(dbResult[0]) != 0)
{
// That ID exists... let's keep finding one that doesn't exist then.
while (!found && attempts++ != 50)
{
id++;
format(string, sizeof(string), "SELECT * FROM `PermCars` WHERE `PermCarID` = '%d'", id);
dbResult[1] = db_query(ServerDB, string);
if (db_num_rows(dbResult[1]) != 0)
{
db_free_result(dbResult[1]);
continue;
}
else
{
db_free_result(dbResult[1]);
found = true;
break;
}
}
}
else found = true;
db_free_result(result);
if( !strcmp( cmdtext, "/lol", true ) )
{
if( !strcmp( cmdtext[ 5 ], "rofl", true ) )
{
SendClientMessage( playerid, -1, "Your parameter after the /lol command is 'rofl'." );
}
return 1;
}
I could find stuff like that in pretty much every gamemode that's released here. If I'd get a dollar for each inefficiency I'd be a rich motherfucker.
|
SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion |
enum pInfo { //(...) pAchievement0, pAchievement1, pAchievement2, pAchievement3, pAchievement4, pAchievement5, pAchievement6, pAchievement7, pAchievement8, pAchievement9, pAchievement10, pAchievement11, pAchievement12, pAchievement13, pAchievement14, pAchievement15, pAchievement16, pAchievement17, pAchievement18, pAchievement19, pAchievement20, pShiftName, pWeapon, pWeapon2, pWeapon3, pWeapon4, pWeapon5, pWeapon6, pWeapon7, pWeapon8, pWeapon9, pWeapon10, pWeapon11, pWeapon12, pAmmo, pAmmo2, pAmmo3, pAmmo4, pAmmo5, pAmmo6, pAmmo7, pAmmo8, pAmmo9, pAmmo10, pAmmo11, pAmmo12, //(...) }
What's the point of this thread anyway? I think it should be moved to
|
I don't! That section is for GOOD topics (shame it has fallen on hard times lately).
|
for(new vehicleid = 1; vehicleid < MAX_VEHICLES; vehicleid++)
{
new query[128], DBResult:result, field[128], var[32];
format(query, sizeof(query), "SELECT * FROM `OtherCars` WHERE `veh_id` = '%d'", vehicleid);
result = db_query(ServerDB, query);
if (db_num_rows(result) != 0)
{
//some stuff
}
}
I simply don't understand, the guy had to know what WHERE means, how come he didn't know that without it he can get all results at once?
|
#defined playerid
new playerid;
new params; // zcmd ....
new customFunction;