CMD:myveh(playerid, params[]) { new Query[300], pname[24], vID; GetPlayerName(playerid, pname, 24); format(Query, sizeof(Query),"SELECT vID FROM `vehicles` WHERE `vOwner` = '%s' ", pname); mysql_query(Query); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Query)) { sscanf(Query, "p<|>i",vID); // printf("VID:\t\t%i", vID); for(new i=1;i<MAX_VEHICLES;i++) { new iMsg[128]; if(strmatch(vInfo[OwnedVeh(i)][vOwner], pName(playerid))) { format(iMsg,sizeof(iMsg), ""#CRED">"#CORANGE"'%s' "#CDGREEN"You Own Model:"#CORANGE"%i"#CDGREEN " CarID:"#CORANGE"%i"#CRED"<",pName(playerid),vInfo[OwnedVeh(i)],vID); SendClientMessage(playerid,-1,iMsg); } } } mysql_free_result(); } return 1; }
CMD:myveh(playerid, params[])
{
new Query[300], pname[24], vID;
GetPlayerName(playerid, pname, 24);
format(Query, sizeof(Query),"SELECT vID FROM `vehicles` WHERE `vOwner` = '%s' ", pname);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() > 0) {
while(mysql_fetch_row(Query)) {
sscanf(Query, "p<|>i",vID);
// printf("VID:\t\t%i", vID);
for(new i=1;i<MAX_VEHICLES;i++) {
new iMsg[128];
if(strmatch(vInfo[OwnedVeh(i)][vOwner], pName(playerid))) {
format(iMsg,sizeof(iMsg), ""#CRED">"#CORANGE"'%s' "#CDGREEN"You Own Model:"#CORANGE"%i"#CDGREEN " CarID:"#CORANGE"%i"#CRED"<",pName(playerid),vInfo[OwnedVeh(i)],vID);
}
SendClientMessage(playerid,-1,iMsg);
}
}
mysql_free_result();
}
return 1;
}
CMD:myveh(playerid, params[]) {
new
i = 0,
iMsg[128],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
while(++i != MAX_VEHICLES) {
if(strmatch(vInfo[OwnedVeh(i)][vOwner], name)) { // strmatch ?
format(iMsg,sizeof(iMsg), #CRED ">" #CORANGE "'%s' "#CDGREEN "You Own Model:" #CORANGE "%i" #CDGREEN " CarID:" #CORANGE "%i" #CRED "<", name, vInfo[OwnedVeh(i)], i);
SendClientMessage(playerid, -1, iMsg);
}
}
return 1;
}
Cheer Nero_3D,that worked a treat,i have just started to use mysql,so im still on a long learning curve,the more i learn,the more i forget
Brandon cheers for your input,thats is the reason i have started to try and understand mysql and how it works,because i am trying to make a complete mysql gamemode using mysql in my spare time,so due to my available spare time,i should finish in 2015 lol |
stock strmatch(const String1[], const String2[]){ if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1))){ return true;} else{ return false;}}