Dynamic vehicle saving system
#1

I got a problem with my saving system for my dynamic vehicle system.

Its giving me these warnings:
Код:
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8270) : warning 219: local variable "Faction" shadows a variable at a preceding level
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8273 -- 8274) : warning 213: tag mismatch
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8270) : warning 203: symbol is never used: "Faction"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
And here is the code:
pawn Код:
stock SaveFactionVehicle(Model, Float:x, Float:y, Float:z, Float:a, ColorA, ColorB, Faction)
{
    new Query[512];
    format(Query, sizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)",
    Model, x, y, z, a, ColorA, ColorB, Faction);
    mysql_query(Query);
    mysql_free_result();
    return 1;
}
Reply
#2

Try this one :

PHP код:
stock SaveFactionVehicle(ModelFloat:xFloat:yFloat:zFloat:aColorAColorBFaction)
{
    new 
Query[512];
        new 
Faction;
    
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)",
    
ModelxyzaColorAColorBFaction);
    
mysql_query(Query);
    
mysql_free_result();
    return 
1;

Reply
#3

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
Try this one :

PHP код:
stock SaveFactionVehicle(ModelFloat:xFloat:yFloat:zFloat:aColorAColorBFaction)
{
    new 
Query[512];
        new 
Faction;
    
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)",
    
ModelxyzaColorAColorBFaction);
    
mysql_query(Query);
    
mysql_free_result();
    return 
1;

All it does is just double it :/
Reply
#4

No you forgot about : new Faction;
Reply
#5

Quote:
Originally Posted by McGuiness
Посмотреть сообщение
I got a problem with my saving system for my dynamic vehicle system.

Its giving me these warnings:
Код:
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8270) : warning 219: local variable "Faction" shadows a variable at a preceding level
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8273 -- 8274) : warning 213: tag mismatch
C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(8270) : warning 203: symbol is never used: "Faction"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
And here is the code:
pawn Код:
stock SaveFactionVehicle(Model, Float:x, Float:y, Float:z, Float:a, ColorA, ColorB, Faction)
{
    new Query[512];
    format(Query, sizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)",
    Model, x, y, z, a, ColorA, ColorB, Faction);
    mysql_query(Query);
    mysql_free_result();
    return 1;
}
Firstly..
Why are you using "%i" When you're not referencing / passing a playerid to another function
Secondly... You already created the value "Faction" When it's defined in the stock it's self...
PHP код:
stock SaveFactionVehicle(ModelFloat:xFloat:yFloat:zFloat:aColorAColorBFaction
Код:
 new Faction; <-- Delete that,
CHANGE
PHP код:
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)"
INTO
PHP код:
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %d, %d, %d)"
should work
Reply
#6

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Firstly..
Why are you using "%i" When you're not referencing / passing a playerid to another function
Secondly... You already created the value "Faction" When it's defined in the stock it's self...
PHP код:
stock SaveFactionVehicle(ModelFloat:xFloat:yFloat:zFloat:aColorAColorBFaction
Код:
 new Faction; <-- Delete that,
CHANGE
PHP код:
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)"
INTO
PHP код:
format(Querysizeof(Query), "INSERT INTO `dynamicvehicles` (ModelID, posX, posY, posZ, posA, ColorA, ColorB, Faction) VALUES(%d, %f, %f, %f, %f, %d, %d, %d)"
should work
Will try that and the i% was just a miss type
Reply
#7

Got a problem with this code:

stock SaveFactionVehicle(Model, Float, Float:y, Float:z, Float:a, ColorA, ColorB, Faction)

Gives me this warning C:\Users\SoulLedger\Desktop\Everest Roleplay\Sever Files\gamemodes\erp.pwn(841 : warning 219: local variable "Faction" shadows a variable at a preceding level
Reply
#8

It means you're using 'faction' some where else too.. just change the variable to something else, though if it stays likes that it shouldnt be a problem too.
cheers!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)