/pm System/ Engine -
Bam23 - 27.03.2011
My server is a work in progress.. Ive been looking for a /pm system..
If anyone could do it for me
I would also like to know where to place this
Aslo i have an engine system like this
pawn Код:
if(strcmp(cmd, "/engineon",true) == 0) {
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID) {
OnPlayerCommandText(playerid,"/me Starts engine with car keys");
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
return 1;
Any way to make it when you press alt it does this.. I just want to replace this with other code not make new line and stuff..
That would be great if you could help me with that
Re: /pm System/ Engine -
Mr_Scripter - 27.03.2011
pawn Код:
if(!strcmp("/pm", cmdtext, true, 3))
{
new tmp[256], gMessage[256], idx, Message[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0x3A47DEFF,"USAGE: /PM (id) (message)");
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");
new iName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
SendClientMessage(playerid,0xFFD720FF,Message);
format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
SendClientMessage(id,0xFFD720FF,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
return 1;
}
Re: /pm System/ Engine -
Bam23 - 27.03.2011
Quote:
Originally Posted by Mr_Scripter
pawn Код:
if(!strcmp("/pm", cmdtext, true, 3)) { new tmp[256], gMessage[256], idx, Message[256]; tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid,0x3A47DEFF,"USAGE: /PM (id) (message)"); new id = strval(tmp); gMessage = strrest(cmdtext,idx); if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID"); new iName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME]; GetPlayerName(id,iName,sizeof(iName)); GetPlayerName(playerid,pName,sizeof(pName)); format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage); SendClientMessage(playerid,0xFFD720FF,Message); format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage); SendClientMessage(id,0xFFD720FF,Message); PlayerPlaySound(id,1085,0.0,0.0,0.0); return 1; }
|
pawn Код:
C:\Users\Darian.Jennifer-PC\Desktop\OkBACKUP\BVGRP.pwn(15471) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Users\Darian.Jennifer-PC\Desktop\OkBACKUP\BVGRP.pwn(15471) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Darian.Jennifer-PC\Desktop\OkBACKUP\BVGRP.pwn(15475) : error 017: undefined symbol "strrest"
C:\Users\Darian.Jennifer-PC\Desktop\OkBACKUP\BVGRP.pwn(15475) : error 033: array must be indexed (variable "gMessage")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Re: /pm System/ Engine -
Austin - 27.03.2011
Sometimes these forums make me shake my head so hard. Noobs scripting is like retards building a house.
Re: /pm System/ Engine -
Mr_Scripter - 27.03.2011
Hm... I'm Noob?
Re: /pm System/ Engine -
Bam23 - 27.03.2011
What about with /engine to you have to press alt?
And no your not noob. I actuelly dont want pm system anymore
Cause people can advert and metagame. Its heavy-rp
I would like an alt system with engine though
Re: /pm System/ Engine -
Stigg - 27.03.2011
Quote:
Originally Posted by Austin
Sometimes these forums make me shake my head so hard. Noobs scripting is like retards building a house.
|
Why don't you try and help rather than hinder with pointless posts, he's obviously new to scripting.
We all started somewhere.
Re: /pm System/ Engine -
Austin - 27.03.2011
Quote:
Originally Posted by Stigg
Why don't you try and help rather than hinder with pointless posts, he's obviously new to scripting.
We all started somewhere.
|
It's just a sad sight to see people given information that isn't as optimized as it could be. However, spoon feeding someone to the answer does not help either.
Re: /pm System/ Engine -
Bam23 - 27.03.2011
All i want right i just want to know how to replace
pawn Код:
if(strcmp(cmd, "/engineon",true) == 0) {
with something like umm...
if(strcmp(bind,"ALT",true) = = 0) {
Lol prolly wrong..
Re: /pm System/ Engine -
Grim_ - 27.03.2011
You will need to use the OnPlayerKeyStateChange callback, check if they pressed that key, and paste the code there. And example is here (not tested):
pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
if( ( newkeys & KEY_SECONDARY_ATTACK ) && !( oldkeys & KEY_SECONDARY_ATTACK ) )
{
if( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
OnPlayerCommandText(playerid,"/me Starts engine with car keys");
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}
I used KEY_SECONDARY_ATTACK because that is my ALT key. It may be different for you and different members that connect to your server. It goes by the configuration set by the players for the keys.
Also, you may need to re-create some of the variables (used in Get/SetVehicleParamsEx) if they weren't created globally.