Correct the error, the next time I will use code in topics
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menufunction onScriptLoad()
{
db <- ConnectSQL( "DataBase.db" );
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Skins ( Name TEXT, Skin NUMERIC )" );
}
function onPlayerSpawn( player )
{
LoadSkin(player);
}
function onPlayerCommand( player, cmd, text )
else if ( cmd == "buyskin" )
{
local Pos = player.Pos, checkpoly;
checkpoly = InPoly( Pos.x, Pos.y, 424.555, 1017.27, 424.379, 1040.05, 403.933, 1040.42, 403.947, 1017.15);
if( !checkpoly ) MessagePlayer( "You need this in the gash store in the mall to buy skins.", player );
else if ( !text ) MessagePlayer ( "Syntax "+ cmd + " <Skin>", player );
else if ( player.Cash <= 100000 ) MessagePlayer( "Insufficient funds.", player );
else
{
local skin = GetTok( text, " ", 1);
if ( skin.tointeger() == 1 || skin.tointeger() == 2 || skin.tointeger() == 3 || skin.tointeger() == 4 || skin.tointeger() == 97 || skin.tointeger() == 98 || skin.tointeger() == 99 || skin.tointeger() == 100 || skin.tointeger() == 101 || skin.tointeger() == 102 || skin.tointeger() == 156 ) MessagePlayer( "Locked Skin .", player );
else if ( skin.tointeger() < 1 || skin.tointeger() > 195 ) MessagePlayer( "Use numbers 1-195 for skins.", player );
else
{
MessagePlayer( "Skin purchased! Price: $100000.", player );
MessagePlayer( "Use /useskin to use this skin or /sellskin to sell it .", player );
player.Cash -= 100000 ;
AddSkin( player, skin );
}
}
}
else if ( cmd == "useskin )
{
if ( !player.IsSpawned ) MessagePlayer("Choose a first skin.", player );
else if ( player.Vehicle ) MessagePlayer(" You can not use this command in a vehicle.", player );
else if ( skin(player) == 0 ) MessagePlayer("You do not have skins.", player );
else
{
MessagePlayer("Changed clothes.", player );
LoadSkin(player);
}
}
else if ( cmd == "sellskin" )
{
if ( !player.IsSpawned ) MessagePlayer("Choose a first skin.", player );
else if ( player.Vehicle ) MessagePlayer(" You can not use this command in a vehicle.", player );
else if ( skin(player) == 0 ) MessagePlayer("You do not have skins.", player );
else
{
MessagePlayer( "Skin sold! Price: $50000.", player );
player.Cash += 50000;
DelSkin( player );
}
}
Add in functions.nut
function AddSkin( player, skin )
{
if ( ( skin ) && IsNum( skin ) ) skin = skin.tointeger();
else if ( skin ) skin = GetSkinID( skin );
QuerySQL( db, "DELETE FROM Skins WHERE Name='" + player.Name + "'" );
QuerySQL( db, "INSERT INTO Skins ( Name, Skin ) VALUES ( '" + player.Name + "', '" + skin + "')" );
}
function DelSkin( player )
{
QuerySQL( db, "DELETE FROM Skins WHERE Name='" + player.Name + "'" );
}
function skin( player )
{
local skin = GetSQLColumnData( QuerySQL( db, "SELECT Skin FROM Skins WHERE Name='" + player.Name + "'" ), 0 );
if ( skin ) return skin;
else return 0;
}
function LoadSkin( player )
{
if ( skin(player) == 0 ) player.Skin = 0 ;
else if ( skin(player) == 1 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 2 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 3 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 4 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 5 ) player.Skin = 5 ;
else if ( skin(player) == 6 ) player.Skin = 6 ;
else if ( skin(player) == 7 ) player.Skin = 7 ;
else if ( skin(player) == 8 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 9 ) player.Skin = 9 ;
else if ( skin(player) == 10 ) player.Skin = 10 ;
else if ( skin(player) == 11 ) player.Skin = 11 ;
else if ( skin(player) == 12 ) player.Skin = 12 ;
else if ( skin(player) == 13 ) player.Skin = 13 ;
else if ( skin(player) == 14 ) player.Skin = 14 ;
else if ( skin(player) == 15 ) player.Skin = 15 ;
else if ( skin(player) == 16 ) player.Skin = 16 ;
else if ( skin(player) == 17 ) player.Skin = 17 ;
else if ( skin(player) == 18 ) player.Skin = 18 ;
else if ( skin(player) == 19 ) player.Skin = 19 ;
else if ( skin(player) == 20 ) player.Skin = 20 ;
else if ( skin(player) == 21 ) player.Skin = 21 ;
else if ( skin(player) == 22 ) player.Skin = 22 ;
else if ( skin(player) == 23 ) player.Skin = 23 ;
else if ( skin(player) == 24 ) player.Skin = 24 ;
else if ( skin(player) == 25 ) player.Skin = 25 ;
else if ( skin(player) == 26 ) player.Skin = 26 ;
else if ( skin(player) == 27 ) player.Skin = 27 ;
else if ( skin(player) == 28 ) player.Skin = 28 ;
else if ( skin(player) == 29 ) player.Skin = 29 ;
else if ( skin(player) == 30 ) player.Skin = 30 ;
else if ( skin(player) == 31 ) player.Skin = 31 ;
else if ( skin(player) == 32 ) player.Skin = 32 ;
else if ( skin(player) == 33 ) player.Skin = 33 ;
else if ( skin(player) == 34 ) player.Skin = 34 ;
else if ( skin(player) == 35 ) player.Skin = 35 ;
else if ( skin(player) == 36 ) player.Skin = 36 ;
else if ( skin(player) == 37 ) player.Skin = 37 ;
else if ( skin(player) == 38 ) player.Skin = 38 ;
else if ( skin(player) == 39 ) player.Skin = 39 ;
else if ( skin(player) == 40 ) player.Skin = 40 ;
else if ( skin(player) == 41 ) player.Skin = 41 ;
else if ( skin(player) == 42 ) player.Skin = 42 ;
else if ( skin(player) == 43 ) player.Skin = 43 ;
else if ( skin(player) == 44 ) player.Skin = 44 ;
else if ( skin(player) == 45 ) player.Skin = 45 ;
else if ( skin(player) == 46 ) player.Skin = 46 ;
else if ( skin(player) == 47 ) player.Skin = 47 ;
else if ( skin(player) == 48 ) player.Skin = 48 ;
else if ( skin(player) == 49 ) player.Skin = 49 ;
else if ( skin(player) == 50 ) player.Skin = 50 ;
else if ( skin(player) == 51 ) player.Skin = 51 ;
else if ( skin(player) == 52 ) player.Skin = 52 ;
else if ( skin(player) == 53 ) player.Skin = 53 ;
else if ( skin(player) == 54 ) player.Skin = 54 ;
else if ( skin(player) == 55 ) player.Skin = 55 ;
else if ( skin(player) == 56 ) player.Skin = 56 ;
else if ( skin(player) == 57 ) player.Skin = 57 ;
else if ( skin(player) == 58 ) player.Skin = 58 ;
else if ( skin(player) == 59 ) player.Skin = 59 ;
else if ( skin(player) == 60 ) player.Skin = 60 ;
else if ( skin(player) == 61 ) player.Skin = 61 ;
else if ( skin(player) == 62 ) player.Skin = 62 ;
else if ( skin(player) == 63 ) player.Skin = 63 ;
else if ( skin(player) == 64 ) player.Skin = 64 ;
else if ( skin(player) == 65 ) player.Skin = 65 ;
else if ( skin(player) == 66 ) player.Skin = 66 ;
else if ( skin(player) == 67 ) player.Skin = 67 ;
else if ( skin(player) == 68 ) player.Skin = 68 ;
else if ( skin(player) == 69 ) player.Skin = 69 ;
else if ( skin(player) == 70 ) player.Skin = 70 ;
else if ( skin(player) == 71 ) player.Skin = 71 ;
else if ( skin(player) == 72 ) player.Skin = 72 ;
else if ( skin(player) == 73 ) player.Skin = 73 ;
else if ( skin(player) == 74 ) player.Skin = 74 ;
else if ( skin(player) == 75 ) player.Skin = 75 ;
else if ( skin(player) == 76 ) player.Skin = 76 ;
else if ( skin(player) == 77 ) player.Skin = 77 ;
else if ( skin(player) == 78 ) player.Skin = 78 ;
else if ( skin(player) == 79 ) player.Skin = 79 ;
else if ( skin(player) == 80 ) player.Skin = 80 ;
else if ( skin(player) == 81 ) player.Skin = 81 ;
else if ( skin(player) == 82 ) player.Skin = 82 ;
else if ( skin(player) == 83 ) player.Skin = 83 ;
else if ( skin(player) == 84 ) player.Skin = 84 ;
else if ( skin(player) == 85 ) player.Skin = 85 ;
else if ( skin(player) == 86 ) player.Skin = 86 ;
else if ( skin(player) == 87 ) player.Skin = 87 ;
else if ( skin(player) == 88 ) player.Skin = 88 ;
else if ( skin(player) == 89 ) player.Skin = 89 ;
else if ( skin(player) == 90 ) player.Skin = 90 ;
else if ( skin(player) == 91 ) player.Skin = 91 ;
else if ( skin(player) == 92 ) player.Skin = 92 ;
else if ( skin(player) == 93 ) player.Skin = 93 ;
else if ( skin(player) == 94 ) player.Skin = 94 ;
else if ( skin(player) == 95 ) player.Skin = 95 ;
else if ( skin(player) == 96 ) player.Skin = 96 ;
else if ( skin(player) == 97 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 98 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 99 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 100 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 101 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 102 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
else if ( skin(player) == 103 ) player.Skin = 103 ;
else if ( skin(player) == 104 ) player.Skin = 104 ;
else if ( skin(player) == 105 ) player.Skin = 105 ;
else if ( skin(player) == 106 ) player.Skin = 106 ;
else if ( skin(player) == 107 ) player.Skin = 107 ;
else if ( skin(player) == 108 ) player.Skin = 108 ;
else if ( skin(player) == 109 ) player.Skin = 109 ;
else if ( skin(player) == 110 ) player.Skin = 110 ;
else if ( skin(player) == 111 ) player.Skin = 111 ;
else if ( skin(player) == 112 ) player.Skin = 112 ;
else if ( skin(player) == 113 ) player.Skin = 113 ;
else if ( skin(player) == 114 ) player.Skin = 114 ;
else if ( skin(player) == 115 ) player.Skin = 115 ;
else if ( skin(player) == 116 ) player.Skin = 116 ;
else if ( skin(player) == 117 ) player.Skin = 117 ;
else if ( skin(player) == 118 ) player.Skin = 118 ;
else if ( skin(player) == 119 ) player.Skin = 119 ;
else if ( skin(player) == 120 ) player.Skin = 120 ;
else if ( skin(player) == 121 ) player.Skin = 121 ;
else if ( skin(player) == 122 ) player.Skin = 122 ;
else if ( skin(player) == 123 ) player.Skin = 123 ;
else if ( skin(player) == 124 ) player.Skin = 124 ;
else if ( skin(player) == 125 ) player.Skin = 125 ;
else if ( skin(player) == 126 ) player.Skin = 126 ;
else if ( skin(player) == 127 ) player.Skin = 127 ;
else if ( skin(player) == 128 ) player.Skin = 128 ;
else if ( skin(player) == 129 ) player.Skin = 129 ;
else if ( skin(player) == 130 ) player.Skin = 130 ;
else if ( skin(player) == 131 ) player.Skin = 131 ;
else if ( skin(player) == 132 ) player.Skin = 132 ;
else if ( skin(player) == 133 ) player.Skin = 133 ;
else if ( skin(player) == 134 ) player.Skin = 134 ;
else if ( skin(player) == 135 ) player.Skin = 135 ;
else if ( skin(player) == 136 ) player.Skin = 136 ;
else if ( skin(player) == 137 ) player.Skin = 137 ;
else if ( skin(player) == 138 ) player.Skin = 138 ;
else if ( skin(player) == 139 ) player.Skin = 139 ;
else if ( skin(player) == 140 ) player.Skin = 140 ;
else if ( skin(player) == 141 ) player.Skin = 141 ;
else if ( skin(player) == 142 ) player.Skin = 142 ;
else if ( skin(player) == 143 ) player.Skin = 143 ;
else if ( skin(player) == 144 ) player.Skin = 144 ;
else if ( skin(player) == 145 ) player.Skin = 145 ;
else if ( skin(player) == 146 ) player.Skin = 146 ;
else if ( skin(player) == 147 ) player.Skin = 147 ;
else if ( skin(player) == 148 ) player.Skin = 148 ;
else if ( skin(player) == 149 ) player.Skin = 149 ;
else if ( skin(player) == 150 ) player.Skin = 150 ;
else if ( skin(player) == 151 ) player.Skin = 151 ;
else if ( skin(player) == 152 ) player.Skin = 152 ;
else if ( skin(player) == 153 ) player.Skin = 153 ;
else if ( skin(player) == 154 ) player.Skin = 154 ;
else if ( skin(player) == 155 ) player.Skin = 155 ;
else if ( skin(player) == 156 ) player.Skin = 156 ;
else if ( skin(player) == 157 ) player.Skin = 157 ;
else if ( skin(player) == 158 ) player.Skin = 158 ;
else if ( skin(player) == 159 ) player.Skin = 159 ;
else if ( skin(player) == 160 ) player.Skin = 160 ;
else if ( skin(player) == 161 ) player.Skin = 161 ;
else if ( skin(player) == 162 ) player.Skin = 162 ;
else if ( skin(player) == 163 ) player.Skin = 163 ;
else if ( skin(player) == 164 ) player.Skin = 164 ;
else if ( skin(player) == 165 ) player.Skin = 165 ;
else if ( skin(player) == 166 ) player.Skin = 166 ;
else if ( skin(player) == 167 ) player.Skin = 167 ;
else if ( skin(player) == 168 ) player.Skin = 168 ;
else if ( skin(player) == 169 ) player.Skin = 169 ;
else if ( skin(player) == 170 ) player.Skin = 170 ;
else if ( skin(player) == 171 ) player.Skin = 171 ;
else if ( skin(player) == 172 ) player.Skin = 172 ;
else if ( skin(player) == 173 ) player.Skin = 173 ;
else if ( skin(player) == 174 ) player.Skin = 174 ;
else if ( skin(player) == 175 ) player.Skin = 175 ;
else if ( skin(player) == 176 ) player.Skin = 176 ;
else if ( skin(player) == 177 ) player.Skin = 177 ;
else if ( skin(player) == 178 ) player.Skin = 178 ;
else if ( skin(player) == 179 ) player.Skin = 179 ;
else if ( skin(player) == 180 ) player.Skin = 180 ;
else if ( skin(player) == 181 ) player.Skin = 181 ;
else if ( skin(player) == 182 ) player.Skin = 182 ;
else if ( skin(player) == 183 ) player.Skin = 183 ;
else if ( skin(player) == 184 ) player.Skin = 184 ;
else if ( skin(player) == 185 ) player.Skin = 185 ;
else if ( skin(player) == 186 ) player.Skin = 186 ;
else if ( skin(player) == 187 ) player.Skin = 187 ;
else if ( skin(player) == 188 ) player.Skin = 188 ;
else if ( skin(player) == 189 ) player.Skin = 189 ;
else if ( skin(player) == 190 ) player.Skin = 190 ;
else if ( skin(player) == 191 ) player.Skin = 191 ;
else if ( skin(player) == 192 ) player.Skin = 192 ;
else if ( skin(player) == 193 ) player.Skin = 193 ;
else if ( skin(player) == 194 ) player.Skin = 194 ;
else if ( skin(player) == 195 ) player.Skin = 195 ;
}
function GetTok(string, separator, n, ...)
{
local m = vargv.len() > 0 ? vargv[0] : n,
tokenized = split(string, separator),
text = "";
if (n > tokenized.len() || n < 1) return null;
for (; n <= m; n++)
{
text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
}
return text;
}
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
If there is any bug comment down there to try to correct, good luck!