-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add /perks #53
base: master
Are you sure you want to change the base?
Add /perks #53
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,19 +25,9 @@ CMD:perks(playerid, params[]) | |
perksStr[256] | ||
; | ||
|
||
for(new i = 0; i < sizeof(gPerkData); i++) | ||
format(perksStr, sizeof perksStr, "%s%s\t%s\t{FFDC2E}$%d\n", perksStr, gPerkData[i][E_NAME], gPerkData[i][E_PURPOSE], gPerkData[i][E_COST]); | ||
|
||
format(perksStr, sizeof perksStr, "{FFFFFF}Perk\t{FFFFFF}Purpose\t{FFFFFF}Cost\n%s", perksStr); | ||
|
||
ShowPlayerDialog(playerid, DIALOG_PERKS, DIALOG_STYLE_TABLIST_HEADERS, "Player Perks", perksStr, "Choose", "Close"); | ||
return 1; | ||
} | ||
|
||
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | ||
{ | ||
if(dialogid == DIALOG_PERKS) | ||
{ | ||
inline perks(pid, dialogid, response, listitem, string:inputtext[]) { | ||
#pragma unused pid, dialogid, inputtext | ||
if(!response) return 1; | ||
new | ||
vehicleid = GetPlayerVehicleID(playerid) | ||
; | ||
|
@@ -78,30 +68,45 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | |
} | ||
case 3: // Teleport | ||
{ | ||
ShowPlayerDialog(playerid, DIALOG_PERKS_TP, DIALOG_STYLE_INPUT, "{FFFFFF}Teleport To A Player", "Input a valid player name/id", "Select", "Cancel"); | ||
inline teleportInline(pid2, did, resp, li, string:it[]) { | ||
#pragma unused pid2, did, li | ||
new | ||
id | ||
; | ||
|
||
if(!resp) return Dialog_ShowCallback(playerid, using inline teleportInline, DIALOG_STYLE_INPUT, "{FFFFFF}Teleport To A Player", "Input a valid player name/id", "Select", "Cancel"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consitency |
||
|
||
if(sscanf(it, "u", id)) { | ||
return Dialog_ShowCallback(playerid, using inline teleportInline, DIALOG_STYLE_INPUT, "{FFFFFF}Teleport To A Player", "Input a valid player name/id", "Select", "Cancel"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consistency, which style do you want to use? |
||
} | ||
|
||
else if(!IsPlayerConnected(id)) { | ||
return SendErrorMsg(playerid, "Invalid Player ID"); | ||
} | ||
|
||
else if(GetPlayerWantedLevel(playerid) != 0) { | ||
return SendErrorMsg(playerid, "You mustn't be a wanted player to use this perk."); | ||
} | ||
|
||
new Float:x, Float:y, Float:z; | ||
new interior = GetPlayerInterior(playerid), vm = GetPlayerVirtualWorld(playerid); | ||
GetPlayerPos(id, x, y, z); | ||
SetPlayerPos(playerid, x, y, z); | ||
SetPlayerInterior(playerid, interior); | ||
SetPlayerVirtualWorld(playerid, vm); | ||
|
||
SendMsgF(playerid, -1, "[PERK-TP] You have successfully teleported to %s", id); | ||
} | ||
Dialog_ShowCallback(playerid, using inline teleportInline, DIALOG_STYLE_INPUT, "{FFFFFF}Teleport To A Player", "Input a valid player name/id", "Select", "Cancel"); | ||
} | ||
} | ||
} | ||
else if(dialogid == DIALOG_PERKS_TP) | ||
{ | ||
new | ||
id | ||
; | ||
|
||
if(sscanf(inputtext, "u", id)) | ||
return ShowPlayerDialog(playerid, DIALOG_PERKS_TP, DIALOG_STYLE_INPUT, "{FFFFFF}Teleport To A Player", "Input a valid player name/id", "Select", "Cancel"); | ||
for(new i = 0; i < sizeof(gPerkData); i++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we wrap this in brackets please? |
||
format(perksStr, sizeof perksStr, "%s%s\t%s\t{FFDC2E}$%d\n", perksStr, gPerkData[i][E_NAME], gPerkData[i][E_PURPOSE], gPerkData[i][E_COST]); | ||
|
||
else if(!IsPlayerConected(id)) | ||
return SendErrorMsg(playerid, "Invalid Player ID"); | ||
format(perksStr, sizeof perksStr, "{FFFFFF}Perk\t{FFFFFF}Purpose\t{FFFFFF}Cost\n%s", perksStr); | ||
|
||
else if(GetPlayerWantedLevel(playerid) != 0) | ||
return SendErrorMsg(playerid, "You mustn't be a wanted player to use this perk."); | ||
|
||
new Float:x, Float:y, Float:z; | ||
GetPlayerPos(id, x, y, z); | ||
SetPlayerPos(playerid, x, y, z); | ||
|
||
SendMsgF(playerid -1, "[PERK-TP] You have successfully teleported to %s", id); | ||
} | ||
return 1; | ||
} | ||
Dialog_ShowCallback(playerid, using inline perks, DIALOG_STYLE_TABLIST_HEADERS, "Player Perks", perksStr, "Choose", "Close"); | ||
return 1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,8 +179,8 @@ static void:_SaveItem(playerid, const itemName[], value) { | |
"UPDATE player_items SET ? = ? + ? WHERE u_id = ?" | ||
); | ||
|
||
MySQL_Bind(stmt_saveItem, 0, itemName, true); | ||
MySQL_Bind(stmt_saveItem, 1, itemName, true); | ||
MySQL_Bind(stmt_saveItem, 0, itemName); | ||
MySQL_Bind(stmt_saveItem, 1, itemName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is needed to allow raw string to be the input There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When i compiled it, gives me an error but gonna fix it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to update package |
||
MySQL_BindInt(stmt_saveItem, 2, value); | ||
MySQL_BindInt(stmt_saveItem, 3, Player_GetAccountID(playerid)); | ||
MySQL_ExecuteThreaded(stmt_saveItem); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline function name is CameCase.